I’m working on 2019.4.9f1 on a 2D project using Universal Rendering Pipeline. The camera settings changed so I’m stating it.
I wrote a
OnMouseExit in a script to manage whenever my mouse cursor is on top of a SpriteRenderer with a collider located at
0,0,0. I have a main camera located at
0,0,-10. I’ve tested the script that manages the
OnMouse events. It works fine.
Problem: But the moment I add a new camera (UI Camera set to Overlay located at
0,0,-10) in and it is enabled,
OnMouse events aren’t getting called. Disabling the UI camera makes the
OnMouse events work normally.
Solutions that have failed:
- I’ve tried setting the tag of the UI Camera to
Main Camera’s tag to
- I tried making the UI Camera a bit closer to the sprites.
I intend to avoid Raycasting and get the
OnMouse Events to work because I want to fix the problem and not work around it.
Question: Any possible reason why my OnMouse events aren’t called?