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();
↧