Unity CLI
Step 1: Install the CLI (if not already installed)
First check if the CLI is available:
bash
which unity && unity --version
If not found, install it:
macOS / Linux
bash
curl -fsSL https://public-cdn.cloud.unity3d.com/hub/prod/cli/install.sh | UNITY_CLI_CHANNEL=beta bash
Windows (PowerShell)
powershell
$env:UNITY_CLI_CHANNEL='beta'; irm https://public-cdn.cloud.unity3d.com/hub/prod/cli/install.ps1 | iex
After installing, open a new shell so
is on PATH, then verify:
If the install script fails or the binary is still not found, tell the user and stop.
Step 2: Verify it works
If this fails with a permissions error or crash, the CLI installation may be broken. Suggest re-running the install script.
Global flags
These work on every command:
| Flag | Description |
|---|
| Output format: (default), , , . Also via env var. |
| Suppress the branded header — use in scripts |
| Disable all interactive prompts — use in CI |
| Suppress non-essential output |
| Print full error details (stack trace + cause chain) on failure. Also via . |
| HTTP/HTTPS/SOCKS/PAC proxy URL for this invocation. Also via . Takes precedence over standard // env vars and the persisted setting. |
| Disable proxy for this invocation, ignoring all sources (env vars, persisted config, system settings). |
| Log one redacted entry per outbound request (host-only URL, resolved proxy, auth source, status, duration) to — for reproducing proxy issues for support. Also via or the persisted setting. |
| Opt a single invocation out of proxy request logging when it's enabled globally. |
Always use when you need to parse output programmatically.
A branded Unity header (logo, wordmark, CLI version) renders on the landing surfaces — bare
,
/
,
, and above the first-run consent prompt. It's shown only on a TTY, prints at most once, and degrades to compact, uncolored text on narrow terminals, without Unicode, or under
. Piped output is unaffected. Use
to suppress it in scripts. Bare
prints usage and exits 0.
Environment variables
All CLI env vars use the
prefix. A CLI flag always overrides the corresponding env var.
| Variable | Mirrors flag | Description |
|---|
| | Output format (, , , ). is a deprecated alias. |
| | Editor version (e.g. , , ). |
| | Chip architecture (, ). |
| path argument | Project path for the command. |
| | Suppress non-essential output. |
| | Show full error details on failure. |
| | Disable interactive prompts. |
| | Suppress the branded banner. |
| | Timeout for in seconds. |
| | Timeout for in seconds. |
| | Active Unity Cloud organization id or name for a single call. |
| — | Service account client ID for non-interactive (CI) auth. |
UNITY_SERVICE_ACCOUNT_SECRET
| — | Service account client secret for non-interactive (CI) auth. |
| | HTTP/HTTPS/SOCKS/PAC proxy URL. Takes precedence over // and the persisted setting. |
| — | Disable the background "update available" check (see unity config update-check
). |
| | Log one redacted entry per outbound request to . Truthy values: , . |
| | Windows: skip the elevated (UAC) install helper for / — for user-writable locations and CI shells that can't answer a UAC prompt. |
| | Number of times retries a module whose download/validation fails. disables retries. |
CI service account auth: Set both
and
UNITY_SERVICE_ACCOUNT_SECRET
to skip the browser OAuth flow — this keeps the secret out of the process argument list and shell history. These map to the
/
inputs of
, but reading the credentials from the environment isn't a full login: it doesn't run the interactive flow or persist credentials to the keyring.
Getting help
If a command fails or you're unsure of the available options, append
or
to any command or subcommand:
bash
unity --help
unity install --help
unity projects --help
unity projects create --help
This works at every level of the command hierarchy.
Exit codes
| Code | Meaning |
|---|
| 0 | Success |
| 1 | General error |
| 2 | Bad arguments |
| 3 | Authentication failure |
| 4 | Precondition not met (e.g. no license active, floating server not configured) |
| 6 | Command-specific failure |
| 130 | Interrupted — Ctrl+C / SIGINT (128 + 2) |
| 143 | Terminated by SIGTERM (128 + 15) — e.g. or a CI/runner timeout. Emitted by long-running commands that install a signal handler to clean up first (currently , which scrubs the temporary Android keystore). |
The
and
commands map an authentication failure (expired/missing session, rejected sign-in) to
, and any other operational failure (network, server error) to
— so scripts can reliably tell "sign in again" apart from a genuine command failure.
Commands
The full per-command reference — syntax, flags, and examples — lives in grouped files under
.
Read the file for the command group you need; all the global
flags, environment variables, and exit codes above apply throughout. Every command also supports
/
(see
Getting help).
| Commands | Reference file |
|---|
| (login / logout / status), (activate / return / server), (org / project) | auth-license-cloud.md |
| (list / add / default / path / install-path / info / upgrade / module), , , , | editors-install.md |
| (list / create / new / clone / open / link / require / upgrade / export / import / pin), , | projects-templates.md |
| (proxy / update-check), | config-hub.md |
| , , | build-run-test.md |
| , , , , , , , , , , , | diagnostics-maintenance.md |
| (+ ), connected editors ( / / / ), , development-only ( / / ) | integration-advanced.md |
Common workflows
Bootstrap a new project from scratch
For a
guided end-to-end experience — concept questions, installing the Editor in the
background while you plan, package selection, and monetization handoff — use the
skill. This section is the raw CLI recipe that skill builds on; use it
directly when you just want the commands.
Take an idea to a running, version-controlled project using only the CLI. Decide the
target
platforms first — they determine which Editor modules you install in step 2. You can add
modules later (
), but a project can't build for a platform until that
platform's module is installed, so it's simplest to decide up front.
bash
# 1. Confirm the CLI works and you're signed in and licensed (see references/auth-license-cloud.md).
unity --version
unity auth status --format json # if signed out: unity auth login
unity license status --format json # if none active: unity license activate
# 2. Pick and install an Editor with the modules your target platforms need.
# Default to the latest LTS (most stable, ~2 years of patches). Reach for a Tech-stream
# release (--stream tech) only for a feature not yet in LTS; treat --stream beta/alpha as
# evaluation-only, never for a project you intend to ship. A deadline argues for LTS.
# (lts / latest aliases work wherever a version is accepted.)
unity releases --stream lts --limit 5 --format json
unity install lts --module android --module ios --yes --accept-eula # add --module webgl, etc.
unity editors --installed --format json # confirm it landed
# 3. List the real template ids this Editor offers — don't guess them.
unity templates list --editor lts --format json
# Common ids: com.unity.template.3d, com.unity.template.2d, and a URP template (id varies by version).
# 4. Create the project. The first positional arg is the NAME; --path sets the parent directory.
# All options supplied, so it won't prompt; add --non-interactive in CI.
unity projects create "MyGame" --path ~/UnityProjects \
--editor-version lts --template com.unity.template.3d
Source control — let the user choose. The CLI publishes the new project to a fresh remote in
one step for any provider.
Always pass tokens on stdin (
) so secrets never
land in shell history or the process list. Pick based on the project — don't default to one:
- Git — GitHub / GitLab ( / ). Ubiquitous. For asset-heavy games
add Git LFS () so large binaries don't bloat history.
- Unity Version Control — UVCS (). Unity's own VCS, built for large binary game
assets: it handles them natively (no LFS needed) and supports file locking — often the
better fit for art-heavy projects or larger teams. Auth uses your Unity sign-in;
selects the region.
bash
# Git (GitHub) — drop --git-lfs if the game isn't asset-heavy. Add --no-initial-commit if you
# want to add packages/assets BEFORE the first commit (see the new-unity-project flow).
unity projects create "MyGame" --path ~/UnityProjects \
--editor-version lts --template com.unity.template.3d \
--vcs github --git-namespace my-org --git-repo my-game \
--git-visibility private --git-default-branch main --git-token-stdin --git-lfs
# Unity Version Control (UVCS) — handles binaries natively, so no LFS:
unity projects create "MyGame" --path ~/UnityProjects \
--editor-version lts --template com.unity.template.3d \
--vcs uvcs --git-namespace my-org --git-repo my-game --vcs-region <region>
Feed the token to
from a secret store, never a literal — e.g.
… --git-token-stdin <<<"$GIT_TOKEN"
where
comes from your CI/secret manager
(UVCS uses your Unity sign-in, so no token is needed). See
references/projects-templates.md for the full
source-control flag set. For a purely local Git repository instead, initialize git with a
Unity-appropriate ignore so the multi-GB
and other generated folders are never committed:
bash
cd ~/UnityProjects/MyGame
git init -b main
# Download (do not pipe to a shell) a maintained Unity .gitignore:
curl -fsSL https://raw.githubusercontent.com/github/gitignore/main/Unity.gitignore -o .gitignore
# Asset-heavy game? Keep large binaries out of git history with Git LFS:
git lfs install
git lfs track "*.psd" "*.fbx" "*.wav" "*.mp3" "*.png" # adjust to your asset types
git add .gitattributes
git add -A
git status # sanity-check: Library/ Temp/ obj/ Build/ must NOT be staged
git commit -m "Initial Unity project: MyGame"
git ls-files | grep -c '^Library/' # must print 0
What the CLI does and doesn't cover. The CLI handles editor, project, and source control.
It does
not manage UPM (Unity Package Manager) packages — to add packages beyond the
template headlessly, use the
skill (C# PackageManager Client
API). For monetization/backend, hand off to the dedicated skills:
implement-in-app-purchases
(IAP),
levelplay-unity-integration
(ads), or
(accounts, cloud save,
economy, remote config, leaderboards). Open the project to start working:
unity open ~/UnityProjects/MyGame
.
Find and install a missing editor
bash
# 1. Check what's installed
unity editors --installed --format json
# 2. Browse available LTS versions
unity releases --lts --limit 5 --format json
# 3. Install
unity install 6000.0.47f1 --yes --accept-eula
Open a project with the correct editor
bash
# 1. Check the project's required editor version
unity projects info /path/to/MyProject --format json
# Look at "editorVersion" in the result
# 2. Confirm that editor is installed
unity editors --installed --format json
# 3. Open (warns if the editor version is missing)
unity open /path/to/MyProject
CI: activate a license, then build
bash
# 1. Sign in non-interactively with a service account
unity auth login --client-id "$UNITY_SERVICE_ACCOUNT_ID" --secret-from-stdin <<<"$UNITY_SERVICE_ACCOUNT_SECRET"
# 2. Activate the entitlement license (or use --serial / --floating)
unity license activate
# 3. Build
unity build /path/to/MyProject \
--editor-version 6000.0.47f1 \
--target StandaloneLinux64 \
--execute-method Builder.PerformBuild \
--allow-install
echo "Exit code: $?"
# 4. Return the seat when done (floating/assigned)
unity license return --yes
CI: headless build
Prefer the dedicated
command (handles batch mode, logging, and CI flags):
bash
unity build /path/to/MyProject \
--editor-version 6000.0.47f1 \
--target StandaloneLinux64 \
--execute-method Builder.PerformBuild \
--allow-install
echo "Exit code: $?"
Or use
(batch mode is automatic — never pass
/
):
bash
unity run /path/to/MyProject \
--editor-version 6000.0.47f1 \
--allow-install \
-- -executeMethod Builder.PerformBuild -logFile build.log
echo "Exit code: $?"
CI: run tests and publish results
bash
unity test /path/to/MyProject \
--editor-version 6000.0.47f1 \
--mode EditMode \
--output ./test-results.xml \
--allow-install \
--timeout 600
echo "Exit code: $?" # 0 = pass, 6 = test failures
Debug the CLI
bash
# Check auth + installed editors + recent errors in one command
unity doctor --format json
# Follow live logs during an install
unity logs --follow --level info
Notes
- and together suppress all prompts — use both in CI.
- always produces machine-readable output; prefer it over parsing human text. Error envelopes are pretty-printed with the same 2-space indent as success envelopes.
- is a shorthand for
unity open [path] --editor-version <version>
. Works with , , or a full version string like .
- The CLI supports kubectl-style plugins: any binary on PATH is callable as .
- Terminal output is hardened against control-character / escape-sequence injection from server-provided values (project titles, editor versions, module names) — C0 controls and non-SGR escape sequences are stripped from table/list/tree output, while SGR color/style codes are preserved.
- The CLI is currently in beta (latest: ). It moved to 1.0 versioning at ; it's still a beta, so keep in the install command until GA ships, after which that part can be dropped.
- As of beta.8 the CLI checks in the background for a newer version and prints an unobtrusive "update available" notice (interactive sessions only; never delays a command). Turn it off with
unity config update-check off
or the env var.
- Outbound HTTP from every CLI command honors the resolved proxy (see ). Inspect what the CLI actually resolved with or
unity doctor --format json
— both surface the active proxy URL, its source, and auth source.