/// <summary> /// 打包AssetBundle /// </summary> void BuildingAssetBundle(emBuildType build_type) { try { bool running = true; SaveData(); running = AssetBundleNameTool.RunningAssetBundleNameTool(asset_bundle_build_); if (running) { running = SceneConfigTool.GenerateAllSceneConfig(asset_bundle_build_.Data.Scenes); } if (running) { BuildAssetBundle.BuildAllAssetBundlesToTarget(GetBuildTargetType(build_type), build_option_); } if (running) { LoadAssetBundleGranularityInfo(); } } catch (System.Exception ex) { Debug.LogError(ex.Message); } SceneConfigTool.RestoreAllScene(asset_bundle_build_.Data.Scenes); EditorUtility.ClearProgressBar(); }
/// <summary> /// /// </summary> void DrawGeneral() { GUILayout.BeginVertical(GUI.skin.FindStyle("flow background"), GUILayout.MaxHeight(80f)); GUILayout.BeginHorizontal(); build_option_ = (BuildAssetBundleOptions)EditorGUILayout.EnumPopup("打包选项", build_option_, GUILayout.MinWidth(200f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); build_type_ = (emBuildType)EditorGUILayout.EnumPopup("打包方式", build_type_, GUILayout.MinWidth(200f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_save_data = GUILayout.Button("仅保存规则文件(" + AssetBundleBuild.FILE_FULL_NAME + ")"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_running_ab_name_tool = GUILayout.Button("仅生成资源AssetBundleName"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_build = GUILayout.Button("开始打包"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (is_save_data) { SaveData(); } if (is_running_ab_name_tool) { AssetBundleNameTool.RunningAssetBundleNameTool(asset_bundle_build_); } if (is_build) { BuildingAssetBundle(); } }
/// <summary> /// 打包AssetBundle /// </summary> void BuildingAssetBundle() { bool running = true; SaveData(); running = AssetBundleNameTool.RunningAssetBundleNameTool(asset_bundle_build_); if (running) { running = SceneConfigTool.GenerateAllSceneConfig(asset_bundle_build_.Data.Scenes); } if (running) { BuildAssetBundle.BuildAllAssetBundlesToTarget(GetBuildTargetType(), build_option_); } if (running) { LoadAssetBundleGranularityInfo(); } SceneConfigTool.RestoreAllScene(asset_bundle_build_.Data.Scenes); }
/// <summary> /// /// </summary> void DrawGeneral() { GUILayout.BeginVertical(GUI.skin.FindStyle("flow background"), GUILayout.MaxHeight(80f)); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("输出位置", EditorCommon.BUILD_PATH); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); build_option_ = (BuildAssetBundleOptions)EditorGUILayout.EnumPopup("打包选项", build_option_, GUILayout.MinWidth(200f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_save_data = GUILayout.Button("仅保存规则文件(" + AssetBundleBuild.FILE_FULL_NAME + ")"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_running_ab_name_tool = GUILayout.Button("仅生成资源AssetBundleName"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_build_win = GUILayout.Button("Windows平台版本 - 打包"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_build_android = GUILayout.Button(" Android平台版本 - 打包"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_build_ios = GUILayout.Button(" IOS平台版本 - 打包"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (is_save_data) { SaveData(); } if (is_running_ab_name_tool) { AssetBundleNameTool.RunningAssetBundleNameTool(asset_bundle_build_); } if (is_build_win) { BuildingAssetBundle(emBuildType.StandaloneWindows); } else if (is_build_android) { BuildingAssetBundle(emBuildType.Android); } else if (is_build_ios) { BuildingAssetBundle(emBuildType.IOS); } }
/// <summary> /// /// </summary> void DrawGeneral() { GUILayout.BeginVertical(GUI.skin.FindStyle("flow background"), GUILayout.MaxHeight(80f)); GUILayout.BeginHorizontal(); GUILayout.Label("打包资源起始路径", GUILayout.MaxWidth(200f)); build_start_full_path_ = GUILayout.TextField(build_start_full_path_); bool is_modify_build_path = GUILayout.Button("更改", GUILayout.Width(40f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("资源版本号", GUILayout.MaxWidth(200f)); asset_bundle_build_.Data.strVersion = EditorGUILayout.TextField(asset_bundle_build_.Data.strVersion); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("输出位置", GUILayout.MaxWidth(200f)); EditorGUILayout.LabelField(EditorCommon.BUILD_PATH); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("打包全部AssetBundle至安装包", GUILayout.MaxWidth(200f)); bool is_all_native = EditorGUILayout.Toggle(asset_bundle_build_.Data.IsAllNative); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("压缩全部AssetBundle", GUILayout.MaxWidth(200f)); bool is_all_compress = EditorGUILayout.Toggle(asset_bundle_build_.Data.IsAllCompress); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("打包选项", GUILayout.MaxWidth(200f)); build_option_ = (BuildAssetBundleOptions)EditorGUILayout.EnumPopup(build_option_, GUILayout.MinWidth(200f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_show_granularity_details = GUILayout.Button("加载粒度数据,显示粒度引用次数与详细引用信息"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_save_data = GUILayout.Button("仅保存规则文件(" + EditorCommon.ASSETBUNDLE_BUILD_RULE_FILE_PATH + ")"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_running_ab_name_tool = GUILayout.Button("仅生成资源AssetBundleName"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_build_win = GUILayout.Button("Windows平台版本 - 打包"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_build_android = GUILayout.Button(" Android平台版本 - 打包"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(20f); bool is_build_ios = GUILayout.Button(" IOS平台版本 - 打包"); GUILayout.Space(20f); GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (is_all_native != asset_bundle_build_.Data.IsAllNative) { ModifyPackNativeConfig(is_all_native); } if (is_all_compress != asset_bundle_build_.Data.IsAllCompress) { ModifyCompressConfig(is_all_compress); } if (is_show_granularity_details) { LoadGranularityInfoAndDisplayProgress(true); } if (is_modify_build_path) { ModifyAssetStartPath(); } if (is_save_data) { SaveData(); } if (is_running_ab_name_tool) { SaveData(); AssetBundleNameTool.RunningAssetBundleNameTool(asset_bundle_build_); SceneConfigTool.GenerateAllSceneConfig(asset_bundle_build_.Data.Scenes); AssetDatabase.Refresh(); } if (is_build_win) { BuildingAssetBundle(emBuildType.StandaloneWindows); } else if (is_build_android) { BuildingAssetBundle(emBuildType.Android); } else if (is_build_ios) { BuildingAssetBundle(emBuildType.IOS); } }