public static void AutoBuildAssetBundles_Android(bool forceRebuild = false) { //判断是不是Android平台 if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android) { var tab = RefreshNewNameAndGetAssetBundleList(); CheckBundleTableAboutShortMD5Repeat(tab); ABBuilder builder = new AssetBundleBuilder5x_Android(); builder.BundleSavePath = AssetBundlePathResolver.BundleAndroidSavedPath; builder.AssetBundleRawInfoList = tab; AssetBundleManifest manifest = null; if (tab.Count > 0) { builder.Begin(); try { manifest = builder.Export(forceRebuild); } catch (System.Exception e) { CommonLog.Error(e); } builder.End(manifest, true); } else { CommonLog.Warning(string.Format("本次导出没有生成文件")); } AssetDatabase.Refresh(); EditorUtility.ClearProgressBar(); CommonLog.Log("资源打包完成!"); return; } CommonLog.Error("请先切换到对应Android平台"); }
public static void BuildAssetBundles_Android() { #if UNITY_ANDROID var tab = CleanAndGenXMLRawInfo(AssetBundlePathResolver.BundleAndroidSavedPath); if (tab == null) { return; } ABBuilder builder = new AssetBundleBuilder5x_Android(); builder.BundleSavePath = AssetBundlePathResolver.BundleAndroidSavedPath; builder.AssetBundleRawInfoList = tab; AssetBundleManifest manifest = null; if (tab.Count > 0) { builder.Begin(); try { manifest = builder.Export(); } catch (System.Exception e) { CommonLog.Error(e); } builder.End(manifest, true); } else { CommonLog.Warning(string.Format("本次导出没有生成文件")); } AssetDatabase.Refresh(); EditorUtility.ClearProgressBar(); CommonLog.Log("资源打包完成!"); return; #else CommonLog.Error("请先切换到对应Android平台"); #endif }