Search Issue Tracker

By Design

Votes

0

Found in

2020.2.0a10

2020.3.3f1

2021.1

2021.2

Issue ID

1328780

Regression

Yes

Prefab doesn't get enabled in the Hierarchy after changing Scene and the Prefab is a child GameObject in the Scene

Scene Management

-

How to reproduce:
1. Open the user's attached "SetActiveTest.zip" project
2. Open the "SetActiveTest" Scene
3. Enter Play Mode
4. Press the left mouse button in the Game view
5. Exit Play Mode
6. Open the "SampleScene" Scene
7. Repeat steps 2-4

Expected result: "TestText" GameObject gets enabled in the Hierarchy window
Actual result: "TestText" GameObject doesn't get enabled in the Hierarchy window

Reproducible with: 2020.2.0a10, 2020.3.8f1, 2021.1.8f1, 2021.2.0a17
Not reproducible with: 2018.4.35f1, 2019.4.27f1, 2020.2.0a9

Note:
- To see a clear repro for a second time you need to delete the Library folder (Restarting the Editor also fixes in some cases)
- The issue is not reproducible when the wanted Prefab is not a child of any GameObject

  1. Resolution Note:

    This is not a regression nor is a bug. When using https://docs.unity3d.com/ScriptReference/Resources.FindObjectsOfTypeAll.html you have to filter the persistent objects out of the result if you only want the Scene objects. It is shown in the example in the documentation how to do this.
    The fact that is seemingly worked before is simply by chance. Had the user selected the prefab in the Project Browser before loading any scenes it would also have failed.

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.