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
- Progress indicator in Meta Quest Build Profile configuration is barely visible
- Slightly transparent objects disappear completely in Web Player when using RenderGraph
- Visual Scripting Components are hidden behind a throbber when Multiplayer Play Mode is running with at least one local instance
- Video Player does not throw an error when playing a video with unsupported encoding settings
- Errors indicating that TMP Extras were not Imported logged when opening the Render Pipeline Converter Window while in Play Mode
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.