Is there a simple way to detect if user clicked a GUI item?

I have a 3D world which on click casts a ray, if nothing is detected then most of the GUI is made invisible. Currently, with something selected, I click a GUI item, but the raycast still fires and the GUI hides without triggering.

I could monitor the mouse_entered / mouse_exited events and control that way, however there's quite a few controls, so the easiest way would be to just monitor the container. Yet I'm wondering if there is some method I've not discovered yet to either trigger the GUI event first or to check the visible controls?

Thanks

https://docs.godotengine.org/en/stable/classes/class_control.html#class-control-constant-mouse-filter-ignore

Learn to use mouse filters. On every node inheriting from control there should be mouse filters that control whether the mouse signal is captured fully, partially or ignored.

Full capture should block it from passing on to nodes underneath, partial should register the click with the node and pass it on to nodes below, and the ignore option should ignore the mouse click on the node but just pass it on below.

If you can't figure it out or if you can't get it to work then post here again and maybe include a screenshot of your node hierarchy.

3 years later