Available environment variables#
The following tables contain a list of environment variables for Unity Build Automation.
System#
System environment variables control the behavior of the system and locations to resources installed. All variables are set and can be used in both Pre-Build and Post-Build Scripts.
Variable | Description |
---|
ANDROID_HOME | Local path to the Android Lib |
ANDROID_NDK_ROOT | Local path to the Android NDK Root directory |
BUILDER_OS | The operating system type that the build is running on. MAC or WINDOWS. |
CCD_BINARY_PATH | the local path to the Cloud Content Delivery binary executable |
HOMEDRIVE | The homedrive location |
HOMEPATH | Relative path to the home directory |
OUTPUT_DIRECTORY | The path to the directory containing the output of the build process |
PLASTIC_CM_PATH | The path to the Plastic CLI. If you use a Windows environment, you may want to convert to the Cygwin path to ensure that the path is valid. |
PLATFORM_HOST | the host of the Build Service API. EX/ usersvc-live.cloud.unity3d.com |
PROJECT_DIRECTORY | The path to the root directory of the project to build |
SCM_MAX_RETRIES | Max number of retries that will be attempted when checking out source code |
UNITY_EXE | the location of the unity engine executable |
UPM_REGISTRY | Url of the Unity Package Manager |
UPM_SERVER_ENABLED | When set to true, the default, will start a UPM Server on the agent |
UPM_SERVER_EXE | Path to the Unity Package Manager Server executable |
UPM_SERVER_PORT | Port that the UPM Server runs at |
USERPROFILE | The user home location on the OS |
WEBGL_STREAMING_ENABLED | When set to true, the default, the path to the StreamingAssets for a WebGL project is excluded from the list of paths to archive |
WORKSPACE | the local path on the agent where all folders for a given build target are created. For example /opt/workspace/workspace |
Build#
Build environment variables relate to and control the execution of a build. Below is the list of general build variables. Build variables associated with a specific execution of a part of the build process are categorized in their section. Some variables may not be set before running a Unity build. We recommended checking for their value before attempting to use them.
Variable | Description |
---|
BACKTRACE_ENABLED | When set to "true", the default, enables error backtracing to be logged |
BUILD_PLATFORM | The type of target being built |
BUILD_TARGET | The ID of the UCB build-target |
BUILD_REVISION | The current revision of the source code that is going to be built. |
BUILDCFG_FILE | The local path to the build config file |
BUILDCFG_TARGET | The name (or id) of the target being built |
BUILDJOB_CACHE | The type of files to cache when a build completes. Default is "library". Can only be set to "workspace" via the Admin UI. If using a dedicated builder is set to local |
CLEAN_BUILD | When set to true will not pull the cached library or workspace. When using git, will run a git clean. When using Perforce, will do a p4 forcesync. |
IS_BUILDER | Set to true when running on a build agent. False when running locally |
LOG_VERBOSE | Set to '1' when the verbose option is passed to xcode projects |
ORG_ID | The id of the UCB organization |
PARENT_BUILD_GUID | The primary artifact for this build will be downloaded and re-signed. Only set when re-signing an already built artifact |
PREVIOUS_SUCCESSFUL_BUILD_REVISION | The last revision of the target that was built successfully |
PROJECT_ID | The id of the UCB project |
SCM_BRANCH | The name of the branch to build |
SCM_REVISION | Specific commit hash to checkout. Only set when specified in the build configuration |
SCM_HOST | The host url for a Source Control Manager |
SCM_USER | The username for checking out code from an SCM |
SKIP_UPLOAD_ARTIFACTS | When set to '1' will skip uploading the built artifacts to UCB |
UCB_BUILD_NUMBER | Build Number for the specific target being built |
XCARCHIVE_PATH | the local path to the Xcode Archives file ex/ '~/Library/Developer/Xcode/Archives/something.xcarchive |
Cloud Content Delivery#
These variables are available only when CCD_ENABLED is set to true, based on the build configuration.
Variable | Description |
---|
CCD_BUCKET_ID | ID of the bucket to upload the content to. Defined by the build configuration |
CCD_CREATE_RELEASE | When set to "true" will create a release from the latest version of the bucket. Defined by the build configuration. |
CCD_ENABLED | When set to "true", will use Cloud Content Delivery. Defined by build configuration |
CCD_PRESERVE_BUCKET | When set to true will not delete the existing contents in a bucket. Defineed by the build configuration |
CCD_STRIP_REMOTE_PATH | When set to 'true' will preserve the bucket as well as upload the files directly to the root instead of at a folder level. Defined by the build configuration. |
Fastlane#
Fastlane environment variables control the behavior of fastlane
Variable | Description |
---|
FASTLANE_USER | The App Store Connect / Apple Developer Portal user for use with fastlane |
FASTLANE_VERBOSE | When set to 'true' will enable verbose logging when executing fastlane commands triggered. |
FL_NOTARIZE_ASC_PROVIDER | WWDR team id for the provider |
FL_NOTARIZE_USE_NOTARYTOOL | When using xcode 13 and this is set to true, it will use the Xcode notary tool when notarizing with fastlane |
FL_NOTARIZE_USERNAME | The App Store Connect / Apple Developer Portal user for use with fastlane |
Perforce#
Variable | Description |
---|
P4_CLEANUPCLIENT | When set to "true" will run a deleteclient when checking out code from Perforce repositories |
P4_SSL | When set to "true" P4 will use SSL when communicating with the server |
P4CLIENT | The P4 Client to use when performing operations against a P4 SCM |
P4PORT | The port that the P4 SCM is running on |
P4USER | The username to checkout code from P4 with |
UVCS (Previously Plastic SCM)#
Variable | Description |
---|
PLASTIC_AUTH_TYPE | The method used to authenticate with the Plastic SCM |
PLASTIC_ENCRYPTION_METHOD | The type of encryption on the Plastic SCM |
Unity#
Variable | Description |
---|
MONO_XMLSERIALIZER_THS | Set to "No" which will not use the THS XML Serializer for Mono builds with Unity |
UNITY_EXTRA_PARAMS | Extra parameters that will be passed to the Unity Editor when running in batch mode |
UNITY_PLAYER_PATH | The local path to the Unity Player |
UNITY_PLAYER_PATH_DATA | the local path to the Unity Player Data file for Windows or Mac builds |
UNITY_PLAYER_PATH_DEBUG_SYMBOLS | the local path to the Unity Player Debug Symbols for Android builds |
UNITY_PLAYER_PATH_DSYM | the local path to the Unity Player Debug Symbols for iOS builds |
UNITY_SHADER_COMPILER_RETRY_COUNT | Set to "3". The number of retry attempts when compiling shaders in Unity |
UNITY_VERSION | The version of Unity the build will run |
UNITY_VERSION_DIFF | True if the version of Unity for this build is different from the last build |
There are two additional dynamically configured environment variables based on the build configuration and output. Due to the nature of how these work, the pattern for determining the name of the environment variable will be provided.
Variable | Description | Pattern |
---|
UNITY_PLAYER_PATH_#{architecture} | The local path to the Unity Player file for a given architecture. | The #{architecture} represents a place holder value for the target architecture of a build. EX/ if one of the output architectures was x86 then the environment variable would be UNITY_PLAYER_PATH_X86 |
UNITY_PLAYER_PATH_#{obb_file_type}_OBB | The local path to the Unity Player OBB file | The #{obb_file_type} represents a place holder value for various OBB files. EX/ the file is name example.file.obb then the environment variable would be UNITY_PLAYER_PATH_FILE_OBB |