Search Issue Tracker
By Design
Votes
0
Found in
2019.1.0a5
2019.4
2020.1
2020.2
2020.2.0f1
2021.1
Issue ID
1301329
Regression
Yes
UI button which is in the higher Hierarchy order is not getting raycast when Prefabs with Canvas are instantiated at runtime
How to reproduce:
1. Open the user's attached "GraphicRaycasterIssue.zip" project
2. Open the "SampleScene" Scene
3. Enter Play Mode
4. Press the "Lower" and "Upper" button on the right side of the Game view
5. Press the "Lower" and "Upper" button on the left side of the Game view
Expected result: "Lower" and "Upper" buttons on both sides of the Game view are interactable
Actual result: "Upper" button on the left side (Instantiated Canvas during runtime) of the Game view is not interactable even though it's Canvas is rendered on top of the "Lower" button's Canvas
Reproducible with: 2019.1.0a5, 2019.4.17f1, 2020.1.17f1, 2020.2.1f1, 2021.1.0b1
Not reproducible with: 2018.4.30f1, 2019.1.0a4
Note:
- In this situation, two Prefabs are getting spawned with Canvas and Button GameObjects and if the first one to be instantiated to a GameObject, which is in a lower Hierarchy order (See attached "1301329_repro.mp4")
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
- Symlinks are broken when a package which contains .xcframework + symlinks is added through Unity Package Manager.
- Crash on ApplyMaterialPass when opening a specific scene
- Memory leak when using Native Plugin in Windows IL2CPP Build
- [URP][Tutorial] Universal 3D Sample tutorial issues
- Gradle error: "...Unexpected error during link..." is thrown when building for Android and targeting API Level 34
Resolution Note (2021.2.X):
Everyroot canvas needs a GraphicRaycaster assigned. This is because we use it to know when to compare the depth based on the common rootRaycaster. Otherwise we dont know that they are part of the same hierarchy. Adding a GraphicRaycaster it works as expected. Its a fluke that it works for the InEditor version.