Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


BuildOptions

Options to configure a build. You can combine multiple build options together.
Read time 2 minutesLast updated 5 days ago

Definition

  • Type: Enum
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
[Flags]public enum BuildOptions

Remarks

Additional Resources: BuildPipeline.BuildPlayer

Examples

using UnityEditor;using UnityEngine;namespace BuildDocExamples{ public class BuildOptions_EditorExamples : MonoBehaviour { [MenuItem("BuildDocExamples/Build/Development and strict mode build")] public static void DevStrictModeBuild() { BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions(); buildPlayerOptions.scenes = new[] { "Assets/scene.unity" }; buildPlayerOptions.locationPathName = "scriptBuilds"; buildPlayerOptions.target = BuildTarget.StandaloneOSX; // use these options for a development and strict mode build buildPlayerOptions.options = BuildOptions.Development | BuildOptions.StrictMode; BuildPipeline.BuildPlayer(buildPlayerOptions); } [MenuItem("BuildDocExamples/Build/Scripts only build")] public static void ScriptsOnlyBuild() { BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions(); buildPlayerOptions.scenes = new[] { "Assets/scene.unity" }; buildPlayerOptions.locationPathName = "scriptBuilds"; buildPlayerOptions.target = BuildTarget.StandaloneOSX; // use these options for building scripts buildPlayerOptions.options = BuildOptions.BuildScriptsOnly | BuildOptions.Development; BuildPipeline.BuildPlayer(buildPlayerOptions); } [MenuItem("BuildDocExamples/Build/DetailedBuildReport build")] public static void DetailedBuildReportExample() { BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions(); buildPlayerOptions.scenes = new[] { "Assets/scene.unity" }; buildPlayerOptions.locationPathName = "DetailedReportBuild/MyGame.exe"; buildPlayerOptions.target = BuildTarget.StandaloneWindows64; buildPlayerOptions.options = BuildOptions.DetailedBuildReport; var buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions); } }}

Fields

Value

Description

AcceptExternalModificationsToPlayerAppends to an existing Xcode (iOS) project during the build process.
AllowDebuggingAllow script debuggers to attach to the Player remotely. You can debug your scripts only if you use BuildOptions.Development.
AutoRunPlayerRun the built Player.
BuildAdditionalStreamedScenesFor internal use
BuildScriptsOnlyOnly build the scripts in a project.
CleanBuildCacheClear all cached build results, resulting in a full rebuild of all scripts and all player data.
CompressWithLz4Use chunk-based LZ4 compression when building the Player.
CompressWithLz4HCUse chunk-based LZ4 high-compression when building the Player.
ConnectToHostSets the Player to connect to the Editor.
ConnectWithProfilerStart the Player with a connection to the Profiler in the Editor.
CustomConnectionIDDetermines if the player should be using the custom connection ID.
DetailedBuildReportGenerates detailed information in the BuildReport.
DevelopmentBuild a development version of the Player.
EnableCodeCoverageEnables code coverage. You can use this as a complimentary way of enabling code coverage on platforms that do not support command line arguments.
EnableDeepProfilingSupportEnables Deep Profiling support in the Player.
ForceEnableAssertionsInclude assertions in the build. By default, the assertions are only included in development builds.
IncludeTestAssembliesBuild will include Assemblies for testing.
NonePerform the specified build without any special settings or extra tasks.
NoUniqueIdentifierWill force the buildGUID to all zeros.
PatchPackagePatch a app package rather than completely rebuilding it.
ShowBuiltPlayerShow the built Player.
StrictModePrevent the build from succeeding if any errors are reported during the build process.
SymlinkSourcesSymlink sources when generating the project. This is useful if you're changing source files inside the generated project and want to bring the changes back into your Unity project or a package.
UncompressedAssetBundleDon't compress the data when creating the asset bundle.
WaitForPlayerConnectionSets the Player to wait for player connection on player start.