Class BuildManager
The Build Manager controls the build process and calls the Option's callbacks.
Inheritance
Implements
Namespace: sttz.Trimmer.Editor
Assembly: Trimmer-Editor.dll
Syntax
public class BuildManager : IProcessSceneWithReport, IPreprocessBuildWithReport, IPostprocessBuildWithReport, IOrderedCallback
Fields
| Improve this Doc View SourceNO_TRIMMER
Scripting define symbol added to remove Trimmer code in player.
Declaration
public const string NO_TRIMMER = "NO_TRIMMER"
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this Doc View SourcecallbackOrder
Declaration
public int callbackOrder { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
CommandLineBuildPath
The output path set using the command line option -output "PATH"
.
(Only set then IsCommandLineBuild is true).
Declaration
public static string CommandLineBuildPath { get; }
Property Value
Type | Description |
---|---|
System.String |
IsCommandLineBuild
Wether the current build was started on the command line using
-executeMethod sttz.Trimmer.Editor.BuildManager.Build
.
Declaration
public static bool IsCommandLineBuild { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceBuild()
Build the profile specified on the command line or the active profile.
Declaration
public static string Build()
Returns
Type | Description |
---|---|
System.String |
Remarks
You can use this method to automate Unity builds using the command line.
Use the following command to build a Build Profile:
unity -quit -batchmode -executeMethod sttz.Trimmer.Editor.BuildManager.Build -profileName "PROFILE_NAME"
You need to replace unity
with the path to the Unity executable and PROFILE_NAME
with the name of the profile you want to build. Run this in the folder of your
Unity project or add -projectPath "PATH_TO_PROJECT"
to select one.
When doing a command line build, the path set by the profile is used. If the
profile doesn't set a path or you want to override it, add the -output "PATH"
option to the arguments.
See the Unity documentation for more information on command line usage.
Build(BuildProfile)
Build a profile for its default targets and with the default build options.
Declaration
public static string Build(BuildProfile profile)
Parameters
Type | Name | Description |
---|---|---|
BuildProfile | profile |
Returns
Type | Description |
---|---|
System.String |
Build(BuildProfile, BuildPlayerOptions)
Build a profile with the given build options.
Declaration
public static string Build(BuildProfile buildProfile, BuildPlayerOptions options)
Parameters
Type | Name | Description |
---|---|---|
BuildProfile | buildProfile | |
UnityEditor.BuildPlayerOptions | options |
Returns
Type | Description |
---|---|
System.String |
Remarks
The BuildPlayerOptions
will be passed through the profile's Options'
PrepareBuild(BuildPlayerOptions, OptionInclusion), which can modify it before the build is started.
Note
If you do not set options.locationPathName
and no option sets
it in the PrepareBuild
callback, then a save dialog will be shown.
GetCurrentScriptingDefineSymbols(BuildTargetGroup)
Convenience method to get the current scripting define symbols as a hash set (instead of a colon-delimited string).
Declaration
protected HashSet<string> GetCurrentScriptingDefineSymbols(BuildTargetGroup targetGroup)
Parameters
Type | Name | Description |
---|---|---|
UnityEditor.BuildTargetGroup | targetGroup |
Returns
Type | Description |
---|---|
System.Collections.Generic.HashSet<System.String> |
GetDefaultOptions(BuildTarget)
Populate the BuildPlayerOptions
with default values.
Declaration
public static BuildPlayerOptions GetDefaultOptions(BuildTarget target)
Parameters
Type | Name | Description |
---|---|---|
UnityEditor.BuildTarget | target |
Returns
Type | Description |
---|---|
UnityEditor.BuildPlayerOptions |
OnBuildError(BuildTarget, String)
Declaration
public static void OnBuildError(BuildTarget target, string error)
Parameters
Type | Name | Description |
---|---|---|
UnityEditor.BuildTarget | target | |
System.String | error |
OnPostprocessBuild(BuildReport)
Declaration
public void OnPostprocessBuild(BuildReport report)
Parameters
Type | Name | Description |
---|---|---|
UnityEditor.Build.Reporting.BuildReport | report |
OnPreprocessBuild(BuildReport)
Declaration
public void OnPreprocessBuild(BuildReport report)
Parameters
Type | Name | Description |
---|---|---|
UnityEditor.Build.Reporting.BuildReport | report |
OnProcessScene(Scene, BuildReport)
Declaration
public void OnProcessScene(Scene scene, BuildReport report)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.SceneManagement.Scene | scene | |
UnityEditor.Build.Reporting.BuildReport | report |
UnityCloudBuild(BuildManifestObject)
Entry point for Unity Cloud builds.
Declaration
public static void UnityCloudBuild(BuildManifestObject manifest)
Parameters
Type | Name | Description |
---|---|---|
BuildManifestObject | manifest |
Remarks
If you don't configure anything, Unity Cloud Build will build without a profile, all Options will use their default value and will be removed.
Add the name of the Build Profile you want to build with to the target name
in Unity Cloud Build, enclosed in double underscores, e.g. __Profile Name__
.
Note that since the target name can contain only alphanumeric characters,
spaces, dashes and underscores, those characters cannot appear in the profile
name either.
Also note that the ability for Options to set build options is limited, currently only setting a custom scene list is supported.