Search Issue Tracker
Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.
Postponed
Votes
5
Found in [Package]
10.0.0-preview.26
Issue ID
1270088
Regression
No
[URP] OnMouse methods are not called when using Camera Stacking with different Culling Masks
How to reproduce:
1. Open attached "CameraStackIssue" project
2. Enter Play Mode
3. Try to click on the cube in the Game View
4. Click on the LevelCamera in the Hierarchy window
5. Enable and disable LevelCamera in the Inspector window
6. Click on the cube in the Game View
7. Observe the console
Expected result: Debug messages are printed before and after enabling and disabling the LevelCamera
Actual result: Debug messages only appear after enabling and disabling the LevelCamera
Reproducible with: 7.4.3(2019.4.8f1), 8.2.0(2020.1.2f1), 10.0.0-preview.26(2020.2.0a20)
Note:
- All OnMouse method related to colliders don't work (OnMouseEnter, OnMouseExit, OnMouseDrag, OnMouseOver, OnMouseDown)
-
SZtamjan
May 03, 2024 17:46
@RAMD21 Thank you!
Keeping priority on -1 on Main camera and clearing flag on UI Camera worked perfectly! -
Junkertankercoder
Dec 16, 2023 21:53
I Fixed this in 2022 URP! Set The main camera Priority to 1, & that fixed it.
-
dasbios
Feb 19, 2023 06:32
A solution for my use case:
My Base and Overlay camera have the same world position/orientation and projection.#1
Put Collider Component on a different GameObject than where it is Sprite Renderer or Mesh Renderer (e.g. on a parent GameObject).#2
Set GameObjects with the collider to be on a Layer that is used by Base Camera with attached Physics (2D) Raycast Component is rendering (e.g. "Default").#3
Set GameObjects that have Renderer Components on the Layer that is Rendered with the Overlay Camera (e.g. "TestUI").And that's it.
The base Camera and its Raycast Component will take care of triggering events, while the Overlay camera will take care of the render.
Example of a Hierarchy #1:
------------------------------------------
ModalWin (Layer: TestUI)
--- ButOK (Layer: Default; Here is attached Collider and Event Trigger Component/Script)
--- --- ButtonVisual (Layer: TestUI; Here is Visual for the button;)Example of a Hierarchy #2:
------------------------------------------
ModalWin (Layer: TestUI)
--- ButOK (Layer: TestUI)
--- --- HitBox (Layer: Default; Here is attached Collider and Event Trigger Component/Script)
--- --- ButtonVisual (Layer: TestUI; Here or is visual for the button;) -
ramd21
Sep 05, 2022 02:47
I found a solution.
To solve this problem set Camera.clearFlags to depthOnly. -
HofiOne
Dec 11, 2021 00:14
for me none of the above mentioned helped
my setup was
- base camera with two overlays
- one of them is rendering only UI (UICamera)
- the UI Canvas render mode is "Screen Space - Camera" and the Render Camera is set to the UICamerain my case the solution was to set the Canvas "Plane distance" greater then 0 (actually > 0.01 but that one is another story)
so, set Plane distance e.g. to 1
hope this helps someone too
-
kolex023
Aug 06, 2021 08:45
To have it documented here as well:
A fellow Unity dev (mikeohc) has found an easy solution:
Set the MainCamera or the Base camera higher priority. It's Worked for me.Original post:
https://gamedev.stackexchange.com/a/192016 -
lloydv
Jul 31, 2021 01:58
Additional info: In my case I have an overlay camera for UI which is at a different world position than the base camera. The issue is the same if the cameras are at the same position, but mouse events do not respond if the positions are different, so it seems that Unity is using the overlay camera position to detect the touch instead of the base camera? The physics raycaster is on the base camera.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Dragon Crashers] Build fails in U6
- [Dragon Crashers] 4 Shader error messages on import
- [Dragon Crashers] Readme text is white on light grey
- Cursor stays in front of the first character when entering text in the TextMeshPro field
- Searching in Hierarchy causes unwanted component calls
Resolution Note:
This case has been postponed, unfortunately this will be tricky to solve and will require lower level work between the engine and URP. As a work around I would advise to enable and disable overlay cameras after they are loaded. This should provide a work around to the issue. My apologies, the issue will be tracked internally and this case will be reopened when it is being worked on.