Hello everyone,
I am creating a 2D Space strategy game. When player click on a position, a waypoint created on that position and then player ships move to that position. But when I am click on an UI object, waypoint position must not be updated. How to achieve this?

My current code:
void Update ()
{
if (Input.GetMouseButtonDown(0))
{
carrierTarget = cam.ScreenToWorldPoint(Input.mousePosition);
carrierTarget.z = transform.position.z;
waypoint.position = carrierTarget;
}
}