예제 #1
0
        /// <summary>
        /// 其它都准备好了,加载AssetBundle
        /// 注意:这个方法只能被 AssetBundleManager 调用
        /// 由 Manager 统一分配加载时机,防止加载过卡
        /// </summary>
        override public void LoadBundle()
        {
            _assetBundleCachedFile = string.Format("{0}/{1}", PathResolver.BundleCacheDir, bundleName);
            _assetBundleSourceFile = PathResolver.GetBundleSourceFile(bundleName);

            if (File.Exists(_assetBundleCachedFile))
            {
                bundleManager.StartCoroutine(LoadFromCachedFile());
            }
            else
            {
                bundleManager.StartCoroutine(LoadFromPackage());
            }
        }
예제 #2
0
        protected override IEnumerator LoadFromPackage()
        {
            //兼容低版本API
#if UNITY_4 || UNITY_4_6 || UNITY_5_1 || UNITY_5_2
            _bundle = AssetBundle.CreateFromFile(_assetBundleSourceFile);
            yield return(null);
#else
            _assetBundleSourceFile = PathResolver.GetBundleSourceFile(bundleName, false);
            AssetBundleCreateRequest req = AssetBundle.LoadFromFileAsync(_assetBundleSourceFile);
            yield return(req);

            _bundle = req.assetBundle;
#endif
            this.Complete();
        }
 protected override IEnumerator LoadFromPackage()
 {
     _assetBundleSourceFile = PathResolver.GetBundleSourceFile(bundleName, false);
     return(base.LoadFromPackage());
 }