Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        //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);
        }