Search Issue Tracker
Won't Fix
Votes
0
Found in
2018.2.3f1
Issue ID
1088912
Regression
No
Serialized asset is null when loaded from bundle after using Resources.UnloadAsset
To reproduce:
1. Open attached project "UnloadBugTest.zip"
2. Open "SampleScene.unity" scene
3. Build MacOS Standalone
4. Open built project
5. Press Load button
6. Press Unload button
7. Press Load button
8. Open Player.log and observe that the "Null texture in holder? : True"
Expected result: second time pressing Load should be Null texture in holder? : False
Actual result: Null texture in holder? : True , even though, the texture is loaded and added
Reproduced on:
2017.4.13f1 2018.1.9f2 2018.2.12f1 2018.3.0b5 2019.1.0a4
Notes:
Doesn't reproduce on Editor
Getting NullReferenceException errors in the Xcode when built for iOS device and trying to press Load button.
Also reproduced on Win 10 machine.
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
Resolution Note:
The reason this is happening is that the Resources API and the Asset Bundle API are two different systems and weren't meant to work together. What's happening is that they're unloading just the single asset that's connected to the asset loaded from the asset bundle. Thanks to preload tree optimizations that we can't change, when accessing the gameobject that's loaded from the asset bundle it only looks at the main asset (the gameobject) to see if it's loaded. They'll have to use Resources.UnloadAllUnusedAssets or whatever that API is because it will unload that main asset from the bundle. When they then reload the asset it'll use the preload tree to load all the dependencies.