Hey all, got a (hopefully) quick question that I can't seem to find the answer for.

I've got a script that does a raycast for click to move movement, working just fine. I've got some UI that I want to work with, but when I click over top of the UI the raycast code still runs. So how do I check to make sure my mouse is not over any UI before it runs?

Here's the code I'm working with:

func _input(event):
if Input.is_action_just_pressed("mouse_left"):
raycast()

  • Toxe replied to this.

    You could use the _unhandled_input callback instead, which will not fire when the click is consumed by a Control node.