public static void BuildPackage() { //1. 解析命令行参数 ParseCommandLineArgs(); //2. 修改打包参数 bool cancel = false; BuildTargetGroup targetGroup = BuildPipelineCommonTools.BuildUtils.GetBuildTargetGroup(mBatchBuildTargetString); BuildTarget target = BuildPipelineCommonTools.BuildUtils.GetBuildTarget(targetGroup); if (!BuildPipelineValidator.CheckSupportedTarget(targetGroup, target)) { return; } if (cancel) { Debug.LogWarning("Build canceled (not enough information)"); return; } ProjectBuildPresetSettings buildPresetSettings = new ProjectBuildPresetSettings() { buildTarget = target, bundleVersionCode = mBatchBuildNumber, version = mBatchBundleVersion, overrideBuildPath = true, buildPath = mBatchBuildPath, overrideExecutableName = true, executableName = mBatchExecutableName, }; //3. 执行打包逻辑 BuildPipelineExecutor.Build(buildPresetSettings); }
public static void BuildBundles() { //1. 解析命令行参数 ParseCommandLineArgs(); BuildTargetGroup targetGroup = BuildPipelineCommonTools.BuildUtils.GetBuildTargetGroup(mBatchBuildTargetString); BuildTarget target = BuildPipelineCommonTools.BuildUtils.GetBuildTarget(targetGroup); if (!BuildPipelineValidator.CheckSupportedTarget(targetGroup, target)) { return; } //这里调用项目自己的ab打包方法 }
private static void PreBuild(BuildEnvsOptions buildOptions) { if (UnityEditor.BuildPipeline.isBuildingPlayer) { return; } PlayerSettingsSnapshot.ApplySnapshotIfFailed(() => { PlayerSettingsSnapshot.TakeSnapshot(); BuildPipelineExecutor.DefaultBuildEnvsOptions.ApplySettings(); bool valid = BuildPipelineValidator.IsValid(buildOptions.targetGroup); if (!valid) { //Debug.LogError("Build failure with errors"); throw new BuildFailedException("Build failure with errors"); } int code = BuildPlayer(buildOptions, false); if (CommandLineArgs.InBatchMode()) { EditorApplication.Exit(code); } }); }