Skip to main content

About the Unity Build Task

This task is responsible for actually building your Unity project and as such the core task of your pipeline. Unity Build will build your project and provide the output files for further processing as needed.

Syntax

# Unity Build Task V3
# Build a Windows/macOS standalone build
- task: UnityBuildTask@3
name: unitybuild
inputs:
buildTarget: standalone
outputPath: $(Build.BinariesDirectory)
outputFileName: drop

Inputs

unityEditorsPathMode

For the task to run successfully it needs to know where Unity installations are located at on the agent. This input lets you configure, where the task should look for installations.

YAMLClassic EditorRequiredDefault
unityEditorsPathModeUnity editors locationYesdefault

Options:

ValueDescription
defaultUses the Unity Hub default installation path
environmentVariableExpects an environment variable UNITYHUB_EDITORS_FOLDER_LOCATION to exist on the agent and specifying where to find editor installations.
specifyLet's you specify a custom path where to lookup editor installations using the input customUnityEditorsPath

customUnityEditorsPath

Should you have configured unityEditorsPathMode to specify, this input is used to read your custom path.

YAMLClassic EditorRequiredDefault
customUnityEditorsPathEditors folder locationYes, if unityEditorsPathMode is specify-

versionSelectionMode

This input defines how to determine the Unity version required to build the project on in the context of this task, which Unity editor version to install and / or actigvate a license with.

YAMLClassic EditorRequiredDefault
versionSelectionModeUnity versionYesproject

Options:

ValueDescription
projectUses exactly the Unity version that the project was last opened with
specifyLet's you specify a Unity version to work with. See also input version

version

The version of the Unity editor to work with, e.g. 6000.0.30f1. You can determine the version for your project using the ProjectVersion.txt file within your project's ProjectSettings folder.

YAMLClassic EditorRequiredDefault
versionVersionYes, if versionSelectionMode is specify-

unityProjectPath

Enter the directory path to the Unity project. If no value is entered, the project is assumed to be in the repository root. Use this input, if your Unity project is nested within subfolders within your repository.

YAMLClassic EditorRequiredDefault
unityProjectPathUnity project pathNo-

buildFlow

Select the build target flow used to build your project. Starting with Unity 6 the new build profiles offer a sophisticated way of building for different platforms.

YAMLClassic EditorRequiredDefault
buildFlowBuild FlowYesplatform

Options:

ValueDescription
platformThe classic way. Select the buildTarget and build for that target platform
profileBuild the project using a build profile. Build profiles were introduced in Unity 6 and give you way more control over PlayerSettings and platform configuration, depending on the target platform you are building for. We recommend reading up on build profiles before using this flow. You'll still need to select the buildTarget that matches your profile, so the task can show you platform specific configuration options in the visual pipeline editor

buildTarget

Sets the build target platform the Unity build is being made for.

YAMLClassic EditorRequiredDefault
buildTargetBuild targetYesstandalone

Options:

ValueDescription
standaloneStandalone (Windows/macOS/Linux) build. The actual platform is determined by the building agent's OS.
WinWindows x86 build.
Win64Windows x64 build.
OSXUniversalmacOS Universal build.
LinuxLinux x86 build. Deprecated for Unity 2019.1 and above.
Linux64Linux x64 build.
LinuxUniversalLinux Universal build. Deprecated for Unity 2019.1 and above.
iOSiOS build.
AndroidAndroid build.
WebWeb build.
WebStreamedWeb Streamed build.
WebGLWebGL build.
XboxOneXbox One build.
PS4Playstation 4 build.
WindowsStoreAppsUniversal Windows Platform build.
SwitchNintendo Switch build.
N3DSNintendo 3DS build.
tvOStvOS build.
visionOSvisionOS build.

buildProfile

Set the build profile saved at the given path as an active build profile for the build. Enter the path to the profile asset within your project here, e.g. /Assets/Settings/Build Profiles/My Profile.asset

YAMLClassic EditorRequiredDefault
buildProfileProfileYes, if buildFlow is profile-

buildScriptType

Specifies which build script should be executed when the build process is run. A build script is a C# script that's placed inside your Unity project and performs a build. If you don't have your own build script, you can use the default provided with the task.

YAMLClassic EditorRequiredDefault
buildScriptTypeBuild script typeYesdefault

Options:

ValueDescription
defaultUses a default build script. The task will add the package games.dinomite.azurepipelines to your project upon building. This package contains all the default build scripts and options required for the task to work
existingUse this option to specify your own build script that should be run to execute the build.
inlineUse this option to specify an inline build script that should be run to execute the build.

inlineBuildScript

If you configured buildScriptType to inline you can enter your build script in the pipeline itself using this input. The task will then crate a C# file in your project and write the inline code into it.

YAMLClassic EditorRequiredDefault
inlineBuildScriptInline build scriptYes, if buildScriptType is inline-

scriptExecuteMethod

Specifies the static method to run via command line to build the project. Only relevant when using buildScriptType existing or inline.

YAMLClassic EditorRequiredDefault
scriptExecuteMethodBuild script execute methodYes, if buildScriptType is inline or existing-

outputPath

Specify the build output path relative to the repository root or fully qualified.

YAMLClassic EditorRequiredDefault
outputPathOutput pathYes, if buildScriptType is default$(Build.BinariesDirectory)

outputFileName

Enter the output filename to be used when constructing the platform-appropriate output. For instance, if you want the output to be 'thegame.exe' on Windows Standalone, enter 'thegame'.

YAMLClassic EditorRequiredDefault
outputFileNameOutput filenameYes, if buildScriptType is defaultdrop

additionalCmdArgs

Specify any additional command line arguments to pass to the Unity process when running the task, should you need them.

YAMLClassic EditorRequiredDefault
additionalCmdArgsCommand line argumentsNo-

androidBuildAppBundle

If set, the build will produce an .aab file instead of an .apk file. This is relevant when you want to create a build that can be published to the Google Play Store.

YAMLClassic EditorRequiredDefault
androidBuildAppBundleBuild Android App Bundle (Google Play)Nofalse

Options:

ValueDescription
trueBuild app bundle instead of APK
falseBuild APK

androidSignAppBundle

If set, you can specify a keystore and credentials to sign the build artifact, you will usually want to do this when producing a release build for deployment to stores.

YAMLClassic EditorRequiredDefault
androidSignAppBundleSign APK / app bundleNofalse

Options:

ValueDescription
trueSign APK / app bundle
falseDo not sign. Use development keystore

androidKeystoreName

Specify any additional command line arguments to pass to the Unity process when running the task, should you need them.

YAMLClassic EditorRequiredDefault
androidKeystoreNameKeystore file pathYes, if androidSignAppBundle is true-

androidKeystorePass

Specify any additional command line arguments to pass to the Unity process when running the task, should you need them.

YAMLClassic EditorRequiredDefault
androidKeystorePassKeystore passwordYes, if androidSignAppBundle is true-

androidKeystoreAliasName

Specify any additional command line arguments to pass to the Unity process when running the task, should you need them.

YAMLClassic EditorRequiredDefault
androidKeystoreAliasNameKeystore alias nameYes, if androidSignAppBundle is true-

androidKeystoreAliasPass

Specify any additional command line arguments to pass to the Unity process when running the task, should you need them.

YAMLClassic EditorRequiredDefault
androidKeystoreAliasPassKeystore alias passwordNo, if not specified and androidSignAppBundle is true, then the task will assume the alias password is the same one as androidKeystorePass. If the alias password is a different one, do make sure to set this value here-

Output variables

This task defines the following output variables, which you can consume in downstream steps, jobs, and stages.

editorLogFilePath

Path to the Unity editor log file generated while executing the task.