Search Issue Tracker
Fixed in 5.3.7
Votes
0
Found in
5.3.6p2
Issue ID
822393
Regression
No
Sometimes errors when LoadAssetAsync and UnloadUnusedAsset is called before GameObject asset is instantiated
When calling UnloadUnusedAssets in a script where a LoadAssetAsync has occured but asset not yet used, AssetBundleRequest.asset will sometimes instantiate with error:
The referenced script on this Behaviour is missing!
The referenced script on this Behaviour (Game Object 'TestPrefab') is missing!
GameObject (named 'TestPrefab') references runtime script in scene file. Fixing!
while( true )
{
AssetBundleRequest request = m_assetBundle.LoadAssetAsync("TestPrefab", typeof(GameObject));
yield return request;
yield return Resources.UnloadUnusedAssets();
GameObject g = Instantiate<GameObject>(request.asset as GameObject);
}
Expected result:
The loading process should not fail and error messages should not appear.
Notes:
Appears to happen less on OSX and IOS
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
g_Laser
Sep 08, 2018 19:30
I believe that's by design- request is a local variable, and UnloadUnusedAssets (according to doc) doesn't preserve assets referenced only by local variable on the stack. If you want it to be preserved, make sure to stick it in a member variable of an object.
tomerpeledNG
May 15, 2018 19:01
I also encountering this with Unit 2017.4.1f1 any workaround?
WinddyHe
Dec 04, 2017 13:11
This bug also appears in the version 5.4.5p5