public void LoadABManifest(bool isPermanent = false) { ResourceInfo bundle = GetResourceInfo(ABConfiger.ASSET_MANIFEST_NAME, ResourceType.RES_ASSETBUNDLE, isPermanent); string path = ABConfiger.GetABFilePath(ABConfiger.ASSET_MANIFEST_NAME); Debug.Log("load asset bundle url==" + path); if (path == string.Empty) { RemoveResourceInfo(ABConfiger.ASSET_MANIFEST_NAME); return; } AssetBundle assetBundle = AssetBundle.LoadFromFile(path); if (assetBundle == null) { RemoveResourceInfo(ABConfiger.ASSET_MANIFEST_NAME); Debug.LogError("Load Local Manifest error!"); return; } assetBundleManifest = assetBundle.LoadAsset <AssetBundleManifest>("AssetBundleManifest"); bundle._assetObj = assetBundle; }
private AssetBundle LoadAssetBundle(string name, string abPath) { string path = ABConfiger.GetABFilePath(abPath); AssetBundle assetbundle = AssetBundle.LoadFromFile(path); if (assetbundle == null) { return(null); } loadedAssetBundles.Add(name, new LoadedAssetBundle(name, assetbundle)); return(assetbundle); }
private IEnumerator LoadAsyncAssetBundle(string name, string abPath, Action <UnityEngine.Object> load = null) { string path = ABConfiger.GetABFilePath(abPath); var bundleLoadRequest = AssetBundle.LoadFromFileAsync(path); while (!bundleLoadRequest.isDone) { yield return(null); } var assetBundle = bundleLoadRequest.assetBundle; if (assetBundle == null) { loadedAssetBundles.Add(name, new LoadedAssetBundle(name, true, null)); yield break; } loadedAssetBundles.Add(name, new LoadedAssetBundle(name, assetBundle)); if (load != null) { load(assetBundle); } }