- Home /
Question by
YanFee · Oct 02, 2016 at 05:38 AM ·
unity 5assetbundleassetbundles10.8
AssetBundle dependency issue
If i load AssetBundle view.ab only,Resources.UnloadUnusedAssets will work fine. but when i load AssetBundle view.ab has dependencies with font.ab,Resources.UnloadUnusedAssets does not work any more. This is the code:
WWW fontwww = new WWW("file:///" + Application.streamingAssetsPath + "/font.ab");
yield return fontwww;
var font = fontwww.assetBundle;
WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/view.ab");
yield return www;
var assetBundle = www.assetBundle;
var request = assetBundle.LoadAllAssetsAsync();
yield return request;
Debug.Log("Load over");
yield return new WaitForSeconds(3.0f);
GameObject obj = GameObject.Instantiate(request.allAssets[0]) as GameObject;
assetBundle.Unload(false);
yield return new WaitForSeconds(3.0f);
Debug.Log("Clear");
GameObject.Destroy(obj);
yield return new WaitForSeconds(1.0f);
Resources.UnloadUnusedAssets();
Comment
Your answer
Follow this Question
Related Questions
Using asset bundles as DLC content (additional maps and levels)? 0 Answers
Loading GameObject with the Script Attached from the AssetBundle. 0 Answers
2D toolkit dynamically load scenes with the new assetbundle of Unity5 0 Answers
Can I create asset bundles dynamically in Unity 5? 1 Answer
How to load a scene from an asset bundle in unity 5? 1 Answer