static void BuildAssetBundles() { var outputPath = Application.streamingAssetsPath + "/AssetBundles/" + AssetBundleUtil.GetPlatformName(); if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget); AssetDatabase.Refresh(); }
public override void LoadAsync() { State = ResState.Loading; LoadDependenyBundleAsync(() => { var assetBundleFileName = Name.Remove(0, PREFIX.Length); // 新增 var path = AssetBundleUtil.FullPathForAssetBundleName(assetBundleFileName); var request = AssetBundle.LoadFromFileAsync(path); request.completed += operation => { Asset = request.assetBundle; State = ResState.Loaded; DispatchOnLoadEvent(true); }; }); }
public override void Load() { var assetBundleFileName = Name.Remove(0, PREFIX.Length); var dependBundleNames = Manifest.GetDirectDependencies(assetBundleFileName); foreach (var dependBundleName in dependBundleNames) { mResLoader.Load <AssetBundle>("ab://" + dependBundleName); } // 新增 var path = AssetBundleUtil.FullPathForAssetBundleName(assetBundleFileName); Asset = AssetBundle.LoadFromFile(path); State = ResState.Loaded; DispatchOnLoadEvent(true); }