Exemple #1
0
        public ILoadRequest <AssetBundle> LoadAssetBundle(string fileName)
        {
            var         request = new UnityAssetRequest <AssetBundle>(fileName);
            AssetBundle ret;

            _dicAssetbundCach.TryGetValue(fileName, out ret);
            if (ret != null)
            {
                request.SetResult(ret);
                return(request);
            }

            LoadAssetBundle(request);

            return(request);
        }
Exemple #2
0
        private IEnumerator LoadAssetBundleImpl(UnityAssetRequest <AssetBundle> request)
        {
            var req1 = AssetBundle.LoadFromFileAsync(request.fileName);

            yield return(req1);

            var assetBundle = req1.assetBundle;

            if (assetBundle != null)
            {
                _dicAssetbundCach[request.fileName] = req1.assetBundle;
                request.SetResult(req1.assetBundle);
            }
            else
            {
                request.SetError($"[AssetBundleLoader] could'n load assetbundle {request.fileName}");
            }
        }
Exemple #3
0
 private void LoadAssetBundle(UnityAssetRequest <AssetBundle> request)
 {
     CoroutineManager.Instance.Start(LoadAssetBundleImpl(request));
 }