How to determine if any control element is clicked/hovered?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By YamiZee

I have a raycast in 3D space that works by mouse clicks. I also have control buttons. The problem is that when I click a control button, the raycast also happens. The raycast is calculated first for whatever reason.

I’d like the buttons to prevent the raycast. I figure if I can determine if a button is being hovered over or clicked, I can stop the raycast. (I know how to check individual buttons, but I mean ALL buttons, without having to copy paste)