Skip to main content
Version: v4 (current)

Build Command

The build command runs a Unity build inside a Docker container (or natively on macOS). It accepts the same parameters as the game-ci/unity-builder GitHub Action, translated to CLI flags. The CLI is provided by the @game-ci/orchestrator package.

game-ci build [options]

Required Options

FlagDescription
--target-platformBuild target platform (e.g. StandaloneLinux64)

Project Options

FlagDefaultDescription
--unity-versionautoUnity Editor version to use. Set to auto to detect from ProjectSettings/ProjectVersion.txt.
--project-path.Path to the Unity project directory
--build-name(empty)Name of the build output file (no file extension)
--builds-pathbuildOutput directory for build artifacts
--build-method(empty)Custom static C# build method to invoke (e.g. MyBuild.PerformBuild)
--build-profile(empty)Path to the build profile to activate, relative to the project root
--custom-parameters(empty)Additional parameters appended to the Unity command line

Versioning Options

FlagDefaultDescription
--versioningSemanticVersioning strategy: Semantic, Tag, Custom, None
--version(empty)Explicit version string (used with --versioning Custom)

Unity Options

FlagDefaultDescription
--manual-exitfalseSuppresses the -quit flag. Use when your build method calls EditorApplication.Exit(0) manually.
--enable-gpufalseLaunches Unity without specifying -nographics
--skip-activationfalseSkip Unity license activation/deactivation
--unity-licensing-server(empty)Unity floating license server address

Engine Options

FlagDefaultDescription
--engineunityGame engine name (unity, godot, unreal, etc.)
--engine-plugin(empty)Engine plugin source: NPM package, cli:<path>, or docker:<image>. See Engine Plugins.

Non-Unity Engine Example

game-ci build \
--engine godot \
--engine-plugin @game-ci/godot-engine \
--target-platform linux \
--custom-image my-godot-image:4.2 \
--provider-strategy aws

Custom Build Parameters

Pass arbitrary parameters to the Unity build process:

game-ci build \
--target-platform StandaloneLinux64 \
--custom-parameters "-myFlag -myKey myValue"

The --custom-parameters string is appended to the Unity command line arguments.

Android Options

FlagDefaultDescription
--android-version-code(empty)Android versionCode override
--android-export-typeandroidPackageExport type: androidPackage (APK), androidAppBundle (AAB), or androidStudioProject
--android-keystore-name(empty)Filename of the keystore
--android-keystore-base64(empty)Base64-encoded keystore file contents
--android-keystore-pass(empty)Keystore password
--android-keyalias-name(empty)Key alias name within the keystore
--android-keyalias-pass(empty)Key alias password
--android-target-sdk-version(empty)Target Android SDK version (e.g. AndroidApiLevel31)
--android-symbol-typenoneAndroid symbol type to export: none, public, or debugging

Android Build Example

game-ci build \
--target-platform Android \
--android-keystore-base64 "$(base64 -w 0 release.keystore)" \
--android-keystore-pass "$KEYSTORE_PASS" \
--android-keyalias-name "release" \
--android-keyalias-pass "$KEY_PASS" \
--android-target-sdk-version AndroidApiLevel31 \
--android-export-type androidAppBundle

Docker Options

Control the Docker container used for the build:

FlagDefaultDescription
--custom-image(empty)Override the Docker image (defaults to unityci/editor with the detected version and platform)
--docker-cpu-limit(empty)CPU limit for the container (e.g. 4 for 4 cores)
--docker-memory-limit(empty)Memory limit for the container (e.g. 8g for 8 GB)
--docker-workspace-path/github/workspacePath where the workspace is mounted inside the container
--run-as-host-userfalseRun as a user that matches the host system
--chown-files-to(empty)User and optionally group to give ownership of build artifacts (e.g. 1000:1000)

Custom Docker Image Example

game-ci build \
--target-platform StandaloneLinux64 \
--custom-image my-registry.com/unity-editor:2022.3.56f1-linux

Authentication Options

FlagDefaultDescription
--ssh-agent(empty)SSH Agent path to forward to the container
--git-private-token(empty)GitHub private token for pulling from private repositories

Provider Strategy

By default, the build command runs locally. You can redirect execution to a remote orchestrator provider:

FlagDefaultDescription
--provider-strategylocalExecution strategy: local, k8s, or aws

When set to anything other than local, the build is handed off to the orchestrator. See Orchestrate Command for cloud-specific options.

Output

Build artifacts are written to the path specified by --builds-path (default build/). The directory structure is:

build/
<target-platform>/
<build-name>

Full Example

game-ci build \
--target-platform StandaloneLinux64 \
--unity-version 2022.3.56f1 \
--project-path ./my-project \
--build-name MyGame \
--builds-path ./dist \
--versioning Semantic \
--custom-parameters "-enableAnalytics" \
--docker-cpu-limit 4 \
--docker-memory-limit 8g

See Also