- Home /
AssetBundle.LoadAssetAsync case freezing in Unity5.5.0p1
When called AssetBundle.LoadAssetAsync many times in the same time will case editor freezing. (android is the same problem)
Like this:
AssetBundle ab = xxx;
AssetBundleRequest req1 = ab.LoadAssetAsync("a1", typeof(GameObject))
AssetBundleRequest req2 = ab.LoadAssetAsync("a2", typeof(GameObject))
AssetBundleRequest req3 = ab.LoadAssetAsync("a3", typeof(GameObject))
Called many times in the same time, and then case freezing.
If called from coroutine one by one will ok.
Is anyone has this problem?
My project is upgrade from unity5.4.3 to unity5.5.0f1(or 5.5.0p1)
I have same problem. in same case. I upgrade my project from 5.4.3 to 5.5.0
I think you may write this to issue tracker
There is an issue that sounds like this: https://issuetracker.unity3d.com/issues/loading-multiple-bundles-using-assetbundle-dot-loadassetasync-freezes-editor
Answer by watsonsong · Dec 20, 2016 at 12:42 AM
I met the same problem, both freeze on android and editor. I queue the load action to resolve this problem. But I think it should be a bug, have find a better way to deal with it?
Answer by Geometrical · Dec 20, 2016 at 12:53 AM
Firstly, the AssetBundle.LoadAssetAsync function is only available in Unity Pro. Are you using Unity Pro?
Secondly, have you tried the non-asynchronous AssetBundle.Load function?
Answer by smflt · Dec 21, 2016 at 02:14 PM
I met the same problem too 5.5.0p2. you should use LoadAsset
Answer by anton-melegov · Dec 29, 2016 at 07:36 AM
I have freeze on this lines:
yield return SceneManager.LoadSceneAsync(sceneName);
assetBundle.Unload (false);
if I comment unload line everything seems ok for me (apart from memory leaks). Issue reproduces if asset bundles didn't cache yet and also appears in older versions of unity. Please keep me in touch if you will found a solution
Answer by CoSpinu · Sep 26, 2017 at 08:57 AM
hello guys( @anton-melegov , @Szzwp , @watsonsong ), we encountered something similar, and for us it worked the fallowing workaround:
AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(Application.streamingAssetsPath + assetBundle);
yield return request; // wait for the asset bundle to load;
AssetBundle tempAB = request.assetBundle;
AssetBundleRequest abr = temp.LoadAllAssetsAsync();
yield return abr; // wait for all assets to be loaded in ram and video ram
myassetBundle = tempAB;
// now you can load any resources you want
myassetBundle.LoadAssetAsync(path);
the trick is to wait for all the resources to be loaded (async so no major freeze will be encountered) and all the loadassetAsync will return most probably with the asset already loaded, so it will be done before the next loadassetasync will be called. We didn't had a lot of time to test exactly what it's happening, but we haven't encountered any other freeze after we implemented this. I hope it helps someone :)
Your answer
Follow this Question
Related Questions
How to import the object from server to unity 2 Answers
Android APK freezes during level load but not in Unity Editor 2 Answers
AssetBundleManager.LoadAssetAsync() doesn't work on some android devices (or is very slow) 2 Answers
how to log for a build game freeze error 0 Answers
Assign www.assetBundle to new AssetBundle Freezes WebPlayer 0 Answers