Search Issue Tracker
Fixed in 5.4.0
Votes
23
Found in
5.3.0f4
Issue ID
758692
Regression
No
Unloading a scene can destroy non-instantiated prefabs that are indirectly referred to by other currently-loaded scene
How to reproduce:
1. Open the attached project "UnloadSceneBug.zip"
2. Open and play Scene1
3. Left Mouse Click to the game view, it will load Scene2
4. LMC again and it will unload Scene1
5. Notice that message which was displayed by Scene1 disappears and the one in Scene2 is "success"
6. Build and run the project for standalone target
7. Repeat step 3 and 4
8. Notice that message which was displayed by Scene1 disappears and the one in Scene2 is "ndataRedirect was destroyed"
Note: By "indirect references" user means that an object in Scene2 contains a reference to a non-instantiated prefab X, and X in turn contains a reference to a non-instantiated prefab Y. After unloading Scene1, X remains valid, but Y disappears.
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Denis159
May 20, 2016 00:17
have this problem Unity 5.4.0b17 (64-bit). I will download version 5.4.0b18
I hope this is fixed
greggaming
Mar 24, 2016 18:49
I can reproduce this bug in Unity 5.3.2p2
My game's "loading" scene deletes itself half a second after the "main" scene loads. All "main" scene prefab references are available for that first half-second, and then turn null.
Calling "DontDestroyOnLoad(prefab)" successfully stops my prefab references from turning null. It's a decent stop-gap, but not ideal.
rempelj
Feb 10, 2016 05:24
Fixed for me in 5.4.0b5
TapHazardGames
Feb 08, 2016 04:30
This issue is definitely still present, please re-open this.
1 - Load base scene
2 - Load scene B as additive
3 - Second scene contains a resources.load call.
4 - Unload scene B: Prefab is now missing from resources list and cannot be loaded until game is restarted completely
dushanl
Feb 02, 2016 23:02
Note that I can still reproduce this bug in 5.4.0b4.
Best workaround I could find is to immediately move any prefabs loaded with Resources.Load[Async] to a scene that never gets unloaded with SceneManager.MoveGameObjectToScene.
Nicolas1212
Jan 27, 2016 17:33
This doesn't reproduce in the editor for me (5.3.0), but every time when building either on Android or desktop. Amazingly frustrating trying to find the cause of this. Building isn't exactly rapid
maxxa05
Jan 26, 2016 17:03
It would help if at least calling Resources.Load wouldn't return null. It seems it doesn't even try to reload the asset if it was deleted.
maxxa05
Jan 26, 2016 16:24
I meant: Ran in the same issue in 5.3.1p3 for our game Kôna.
maxxa05
Jan 26, 2016 16:23
Ran in the same issue in 5.3.1p3 Kôna. We load/unload scenes for houses and such and use prefabs for terrain tiles. As you can expect, the terrain chunks get deleted, and we got big holes where we should have a terrain tile. So yes, that's a BIG issue.
llutman
Jan 21, 2016 21:50
Ran into this problem today using 5.3.1f1.
1) Load SceneA
2) GameObject prefab = Resources.Load("MyPrefab", typeof(GameObject)) as GameObject;
3) yield return SceneManager.LoadAsync("SceneB", LoadSceneMode.Additive);
4) SceneManager.UnloadScene("SceneA");
5) GameObject prefab = Resources.Load("MyPrefab", typeof(GameObject)) as GameObject;
After (2), the prefab variable holds a valid reference.
After (5), the prefab variable is null.
It seems like calling UnloadScene somehow destroys the prefab, and it can't be loaded again. This only happens on a device, it works fine in the editor.