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

uGUI

-

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")

  1. 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.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.