- Home /
 
UI 4.6 Detecting if mouse,touch event is over any GUI element
I move a player object around by ray casting into the world. But if the player clicks on a UI element such as a button I need to know that in my movement script so it ignores the world click.
However I cannot find a way to detect if the mouse or user last touch was over a button.
There are some other questions similar to this one but I cannot get the answers to work.
I think my problem is using revision 20 of the system as I can't find its version of :
 // <= 4.6b18
 if (!EventSystemManager.currentSystem.IsPointerOverEventSystemObject() )
  
 // >= 4.6b19
 if (!EventSystem.current.IsPointerOverGameObject() )
  
 
              Answer by ina · Dec 02, 2014 at 12:26 PM
EventSystem should now be called as an instance variable.
 EventSystem eventsystem;
 eventsystem.IsPointerOverGameObject();
 
              Your answer
 
             Follow this Question
Related Questions
A node in a childnode? 1 Answer
Unity 4.6B UI Scrollbar Usage 1 Answer
unity 4.6 button functions? 1 Answer
Detecting a UI element is over another UI element 1 Answer
Making a Menu like UDK in Unity 4.6 1 Answer