unity – OnMouse Events stop working when multiple cameras are active


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 OnMouseEnter and 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:

  1. I’ve tried setting the tag of the UI Camera to MainCamera and set
    Main Camera’s tag to Default.
    https://answers.unity.com/questions/241334/onmousedown-w-multiple-cameras-doesnt-work-right.html
  2. I tried making the UI Camera a bit closer to the sprites.
    https://answers.unity.com/questions/425478/onmousedown-not-firing.html

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?