private IEnumerator LoadAssetBundle(string relativeUrl) { while (_assetBundleManifest == null) { if (_assetBundleManifestLoadFailure) { yield break; } yield return(null); } if (_assetBundleManifestLoadFailure) { yield break; } var abPath = relativeUrl.ToLower(); var deps = _assetBundleManifest.GetAllDependencies(abPath); AssetBundleLoader[] _depLoaders = new AssetBundleLoader[deps.Length]; for (var d = 0; d < deps.Length; d++) { var dep = deps[d]; _depLoaders[d] = AssetBundleLoader.Load(dep, null); } for (var l = 0; l < _depLoaders.Length; l++) { var loader = _depLoaders[l]; while (!loader.IsCompleted) { yield return(null); } // after bundle load finished, load asset } relativeUrl = relativeUrl.ToLower(); var bytesLoader = BytesLoader.Load(AssetManager.GetAssetBundleAbsoluteURL(relativeUrl)); while (!bytesLoader.IsCompleted) { yield return(null); } if (!bytesLoader.IsSuccess) { Debug.LogErrorFormat("[AssetBundleLoader]Error Load AssetBundle: {0}", relativeUrl); OnFinish(null); yield break; } byte[] bundleBytes = bytesLoader.Bytes; //Progress = 1 / 2f; //bytesLoader.Release(); // 字节用完就释放 AssetBundleParser bundleParser = new AssetBundleParser(RelativeResourceUrl, bundleBytes); while (!bundleParser.IsFinished) { yield return(null); } //Progress = 1f; var assetBundle = bundleParser.Bundle; if (assetBundle == null) { Debug.LogErrorFormat("WWW.assetBundle is NULL: {0}", RelativeResourceUrl); } else { //yield return LoadAllAssetsAsync(assetBundle); } OnFinish(assetBundle); //Debug.Log("Loaded ab: " + assetBundle.name + ", assets --> " +assetBundle.GetAllAssetNames().Length); foreach (string str in assetBundle.GetAllAssetNames()) { // Debug.Log("Loaded ab: " + assetBundle.name + ", asset --> " + str); } //Array.Clear(cloneBytes, 0, cloneBytes.Length); // 手工释放内存 //GC.Collect(0);// 手工释放内存 }