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
- Can not navigate through the Scene view when using a drawing tablet
- Crash on EditorDisplayDialogProc when opening Dialog box containing buttons with unusually long labels
- Crash on AsyncWriteImageToR2dFile when baking lightmaps using custom parameter with 16x Anti Aliasing samples
- Application Cloud Connection Id is incorrect when using Build Profile with Player Setting Overrides.
- [Android] [GameActivity] UI is unresponsive when Application Entry Point is set to GameActivity
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.