Question by
Haedrian · Mar 28, 2016 at 06:09 PM ·
2duieventsystem
Get object under IsPointerOverGameObject()
I've got a Canvas with some elements. Some of those elements are buttons, and others should be 'transparent' to the user (ie - should support click-through).
I've got code written in the Update for handling mouse clicks and the like, and I've ensured that buttons don't 'clickthrough' through the use of IsPointerOverGameObject()
void Update ()
{
UnityEngine.EventSystems.EventSystem ct
= UnityEngine.EventSystems.EventSystem.current;
if (ct.IsPointerOverGameObject())
{
return; //button handling it
}
//... Other code for handling non-interface mouse things
}
Now the problem is, I'd like to check for the type of Gameobject, and for some of them, I'd like the click to be handled in the Update. How do I get the actual GameObject which is causing IsPointerOverGameObject() to return true?
Comment