- Home /
OnMouse events with overlapping colliders
I have one large collider and one small, over the large, large completely surrounds the small. And i want the mouse exit/enter event not to fire for the large collider when the mouse hovers over the small one. Because it is still over the large one! I've tried different layers and tags, but in vain. The description of the mouse events doesn't mention that mouse can only be over one object.
You just have to do it with the Raycast. Cast a ray from the mouseposition on the screen and test what objects does that hit. Invoke your action on the big object on the condition that the small one is not hit.
Your answer
Follow this Question
Related Questions
OnMouseEnter when enabling a object 2 Answers
OnMouseEnter/Exit fail when Parent. [Solved] 0 Answers
OnMouseOver Problem 3 Answers
Changing the Mouse's Range for OnMouse events 0 Answers
OnMouse events (e.g. OnMouseEnter) not working with new Input System 2 Answers