// 内部构建方法 private static void BuildInternal(BuildTarget buildTarget) { Debug.Log($"[Build] 开始构建补丁包 : {buildTarget}"); // 打印命令行参数 int buildVersion = GetBuildVersion(); string packPath = GetPackPath(); bool isForceBuild = IsForceBuild(); Debug.Log($"[Build] Version : {buildVersion}"); Debug.Log($"[Build] 打包目录 : {packPath}"); Debug.Log($"[Build] 强制重建 : {isForceBuild}"); // 初始化Builder AssetBuilder builder = new AssetBuilder(); builder.InitAssetBuilder(buildTarget, buildVersion, packPath); // 设置配置 builder.CompressOption = AssetBuilder.ECompressOption.ChunkBasedCompressionLZ4; builder.IsForceRebuild = isForceBuild; builder.IsAppendHash = false; builder.IsDisableWriteTypeTree = false; builder.IsIgnoreTypeTreeChanges = true; // 执行构建 builder.PreAssetBuild(); builder.PostAssetBuild(); // 构建成功 Debug.Log("[Build] 构建完成"); }
private void InitInternal() { if (_assetBuilder != null) { return; } _centerStyle = new GUIStyle(GUI.skin.GetStyle("Label")); _centerStyle.alignment = TextAnchor.UpperCenter; _leftStyle = new GUIStyle(GUI.skin.GetStyle("Label")); _leftStyle.alignment = TextAnchor.MiddleLeft; // 创建构建器类 Version appVersion = new Version(Application.version); int buildVersion = appVersion.Revision; BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget; string packPath = EditorPrefs.GetString(StrEditorPackingPath, PatchDefine.StrMyPackRootPath); _assetBuilder = new AssetBuilder(); _assetBuilder.InitAssetBuilder(buildTarget, buildVersion, packPath); // 读取配置 LoadSettingsFromPlayerPrefs(_assetBuilder); }