- Home /
How do you detect OnMouseEnter on a collider that is behind a GUI element?
I have objects that can be interacted with by rolling the cursor over them, making them move around on screen. When the objects get to a position where they are behind a GUI Box or Button, they no longer detect the mouse cursor rolling over them. I need a way to detect the mouse through a GUI element. If anyone knows how I would greatly appreciate it!
Answer by Ben-Stoneman · Feb 14, 2013 at 05:39 PM
Hey Joe,
OnMouseEnter requires you to click on the object behind the GUI Element.
Try Using OnMouseOver, this will then allow you to hover your cursor over the objects behind the GUI and activate the function/Method within.
void OnMouseOver ()
{
Debug.Log("Mouse Entered");
}
Ensure the GUI Element does not have a OnMouseOver script attached, otherwise you will recieve a conflict.
Your answer
Follow this Question
Related Questions
Internal collisions 1 Answer
OnMouseEnter not working 6 Answers
OnMouseEnter over a Collider, what's the distance? 1 Answer
OnMouseEnter through colliders 2 Answers
GUI flashing on hover 0 Answers