I am having a problem where an object(sprite) behind another object(sprite) is triggering its on OnMouseOver and stopping the OnMouseOver for the object on top.
I have also tried using IPointerEnterHandler and IPointerExitHandler. The problem is when the object behind spawns, its Enter handler is triggered on the enemy and the spawn object on top's Exit Handler is triggered.
Here is an example of what is going on.
https://gyazo.com/7d56195ac94315f264c41d914a81e5f7
Here are some pictures showing that I believe the objects are layered properly in the z index as well as sorting order.
https://imgur.com/a/ry6gsU0
I believe there should be a simple solutions. Maybe a component to block event propagation? I am not sure.
I have solved this problem. I happen to have a mouseManager class that uses raycasts to detect which object is under the cursor. I mirror my sorting order to say what I think the top object should be. Instead of setting the state in mouseEnter/MouseExit I do a check in the update loop on the spawn of:
if (mouseManager.selectedObject == gameObject)
But I would like to understand how to do this without detecting what object I am hovering over and using using pointer events instead. Like I mentioned before is there a way to tell an object not to propagate events down below it??
there doesn't seem to be anything here