protected bool CreateAssetBundleAsync(string assetbundleName, bool isIndependent = false) { #if UNITY_EDITOR // EditorApplication.isPaused = true; #endif if (IsAssetBundleLoaded(assetbundleName) || webRequesting.ContainsKey(assetbundleName)) { return(false); } var creater = ResourceWebRequester.Get(); var url = AssetBundleUtility.GetAssetBundleFileUrl(assetbundleName); if (!manifest.GetAssetBundleHash(assetbundleName).isValid&& idpManifest.GetAssetBundleHash(assetbundleName).isValid) { url = AssetBundleUtility.GetIndependentAssetBundleFileUrl(assetbundleName); } creater.Init(assetbundleName, url); webRequesting.Add(assetbundleName, creater); webRequesterQueue.Enqueue(creater); // 创建器持有的引用:创建器对每个ab来说是全局唯一的 IncreaseReferenceCount(assetbundleName); return(true); }
//TODO 临时资源,后期必须要修改 // 本地异步请求Assetbundle资源,不计引用计数、不缓存,Creater使用后记得回收 public ResourceWebRequester RequestIndependentAssetBundleAsync(string assetbundleName) { var creater = ResourceWebRequester.Get(); var url = AssetBundleUtility.GetIndependentAssetBundleFileUrl(assetbundleName); creater.Init(assetbundleName, url, true); webRequesting.Add(assetbundleName, creater); webRequesterQueue.Enqueue(creater); return(creater); }