/// <summary> /// 其它都准备好了,加载AssetBundle /// 注意:这个方法只能被 AssetBundleManager 调用 /// 由 Manager 统一分配加载时机,防止加载过卡 /// </summary> override public void LoadBundle() { _assetBundleCachedFile = string.Format("{0}/{1}", AssetBundlePathResolver.BundleCacheDir, bundleName); _assetBundleSourceFile = AssetBundlePathResolver.GetBundleSourceFile(bundleName); if (File.Exists(_assetBundleCachedFile)) { bundleManager.StartCoroutine(LoadFromCachedFile()); } else { bundleManager.StartCoroutine(LoadFromPackage()); } }
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 = AssetBundlePathResolver.GetBundleSourceFile(bundleName, false); AssetBundleCreateRequest req = AssetBundle.LoadFromFileAsync(_assetBundleSourceFile); yield return(req); _bundle = req.assetBundle; #endif this.Complete(); }
public AssetBundlePathResolver() { instance = this; }
public AssetBundleBuilder4x(AssetBundlePathResolver pathResolver) : base(pathResolver) { }
public AssetBundleManager() { Instance = this; pathResolver = new AssetBundlePathResolver(); }
public ABBuilder(AssetBundlePathResolver resolver) { this.pathResolver = resolver; this.InitDirs(); AssetBundleUtils.pathResolver = pathResolver; }
public AssetBundleBuilder5x(AssetBundlePathResolver resolver) : base(resolver) { }