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
- "NullReferenceException" is thrown when setting a long string in TMP with "Atlas Population Mode" set to "Dynamic" and "Multi Atlas Textures" enabled
- TextMeshPro text is misaligned when alignment is set via script
- A DX11 shader error is thrown when compiling shaders for platforms without DX11 support
- Rigidbody2D.Slide correctly ignores colliders specified with "Physics2D.IgnoreCollision" however encountering them can still modify movement behaviour in subtle ways.
- [Quality Hackweek] A black separator appears when the left panel in the UI Builder tab is resized, and the tab is narrow
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.