Search Issue Tracker
By Design
Votes
0
Found in
2020.3.45f1
2021.3.19f1
2022.2.7f1
2023.1.0b4
2023.2.0a2
Issue ID
UUM-27815
Regression
No
Enabling and disabling GameObject as a trigger makes its collider cover other colliders
Reproduction steps:
1. Open the attached “2d.zip“ project
2. Open “SampleScene” scene
3. Enter Play mode and use “A” key to move “trashcan” GameObject to “Player” GameObject
4. Press “E” key and click on “Right” GameObject then click on “Door (storage)” GameObject
5. Drag “roller” GameObject onto “board” GameObject and enable Is Trigger in “board” GameObject
6. Click and drag around the “roller” GameObject on its part behind the “board” GameObject
7. Disable Is Trigger in “board” GameObject and repeat step 6
Expected result: “roller” GameObject is dragged around the Game window
Actual result: “roller” GameObject doesn’t move
Reproducible with: 2020.3.45f1, 2021.3.19f1, 2022.2.7f1, 2023.1.0b4, 2023.2.0a2
Reproduced on: macOS Monterey 12.6 (Intel)
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
- UI Text color is incorrect when text is rendered on SubMeshUI
- "Invalid SortingGroup index set in Renderer" errors when making many modifications in same frame
- Crash on GizmoBufferSizeHistory::GetBuffer() when opening a specific scene
- RenderTexture is not initialized when it is set as Material's Texture
- Branch node outputs a random value instead of a constant on the false conditon
Resolution Note:
So I'll write this up on the case but this looks like the expectation here is that the rendering order to match what OnMouseDrag returns. OnMouseDrag isn't a 2D physics thing, it's a Camera thing and it simply uses a 2D physics query (https://docs.unity3d.com/ScriptReference/Physics2D.GetRayIntersection.html) to ask what's there but 2D physics doesn't know about render order and because it's 2D, it has no Z (no depth) either. This query does sort by Transform Z on the GameObject though but in the project, both GameObject are on Z=0 so the order is undefined and the first one encountered will be returned. Changing the IsTrigger (which causes the collider to be regenerated) likely just changes the undefined order so you'll get a different collider returned.