CLI-first automation for the Unity Editor.
SVG logo | PNG icon (128) | PNG icon (512) | Releases | npm
UCP is a cross-platform CLI plus Unity Editor bridge for programmatic control of Unity projects. It is built for local automation, AI agents, CI/CD, and repeatable editor workflows.
UCP is split into two parts:
ucp: a Rust CLI for operators, agents, and scriptscom.ucp.bridge: a Unity Editor package that exposes editor operations over localhost WebSocket JSON-RPC
The bridge writes .ucp/bridge.lock in the Unity project root. The CLI reads that lock file, authenticates with a per-session token, and then talks to the editor through the bridge.
Most bridge-backed commands can now auto-start Unity when the project and editor path can be resolved.
cli/: Rust CLI exposed asucpunity-package/com.ucp.bridge/: Unity bridge packagenpm/: npm wrapper that downloads the matching released binary and bundles the bridge payloaddocs/: markdown docs sourcewebsite/: Vite/React docs site built fromdocs/andskills/skills/unity-control-protocol/SKILL.md: canonical agent skill file
This is the current happy-path workflow for real project use:
cd /path/to/MyUnityProject
ucp install
ucp open
ucp connect
ucp scene snapshot
ucp scene focus --id 46894 --axis 1 0 0
# edit files locally in your workspace
ucp compile
ucp play
ucp screenshot --view scene --output capture.png
ucp stop
ucp run-tests --mode edit
ucp closeRecommended usage notes:
- Prefer normal workspace file edits plus
ucp compilefor script iteration. - Use
ucp files read|write|patchwhen you intentionally want bridge-mediated project file I/O. - Use
ucp openwhen you want an explicit lifecycle step. - Use
ucp connectwhen you want "make sure Unity is running and verify the bridge is healthy" in one command. - Use
ucp scene snapshotto discover instance IDs, thenucp scene focusanducp screenshotfor visual iteration loops.
npm install -g @mflrevan/ucppnpm add -g @mflrevan/ucp
pnpm approve-buildscargo install --git https://github.com/mflRevan/unity-control-protocol --path cliFrom a Unity project root:
ucp installDefault behavior:
- writes a tracked
com.ucp.bridgedependency intoPackages/manifest.json - pins that dependency to the matching CLI tag
- stays non-interactive unless you pass
--confirm - does not inject a local
file:dependency
Explicit local bridge development modes:
ucp install --devucp install --embeddeducp install --bridge-path <path>
Manual manifest dependency:
{
"dependencies": {
"com.ucp.bridge": "https://github.com/mflRevan/unity-control-protocol.git?path=unity-package/com.ucp.bridge#v0.4.0"
}
}- explicit editor bootstrap
- launches Unity for the target project
- waits for
.ucp/bridge.lock - waits for handshake success
- will not incorrectly treat a half-closed editor as healthy
- ensures Unity is running
- waits for the bridge
- reports Unity version, project name, and protocol version
- is the simplest “make this project ready for automation” entrypoint
- requests graceful shutdown through the bridge first
- falls back to window-close behavior when needed
- can force terminate with
ucp editor close --force - now reports when the editor is still closing instead of falsely claiming success
Before bridge-backed commands launch or connect, UCP checks whether the tracked bridge dependency is behind the current CLI version.
auto: update the tracked dependency before launch or connectwarn: report drift without mutating the projectoff: skip drift handling
Use --bridge-update-policy warn if you want notification-only behavior.
UCP resolves Unity in this order:
--unity <path>UCP_UNITY- saved CLI settings
--force-unity-version <version>ProjectSettings/ProjectVersion.txt- Unity Hub project metadata
- standard and secondary Unity Hub install roots
Unity.exeonPATH
If the project's configured Unity version is known but not installed, UCP fails instead of silently picking a different editor. Use --force-unity-version <ver> only when you explicitly accept that risk.
ucp doctorucp installucp uninstallucp bridge status|updateucp connectucp editor open|close|restart|status|logs|psucp open|close
ucp playucp stopucp pauseucp compile
ucp scene list|active|load|focus|snapshotucp files read|write|patchucp screenshotucp logsucp run-testsucp exec list|run
ucp object ...ucp asset ...ucp material ...ucp prefab ...ucp settings ...ucp build ...ucp vcs ...
All commands support --json. Most also support --project, --unity, --bridge-update-policy, --dialog-policy, --timeout, and --verbose.
ucp doctor
ucp connect
ucp scene snapshot --depth 1
ucp scene activeucp scene snapshot --filter "Player"
ucp scene focus --id 46894 --axis 0 0 -1
ucp screenshot --view scene --output scene-pass.png
ucp object set-property --id 46894 --component Transform --property m_LocalPosition --value "[0,1,0]"
ucp screenshot --view scene --output scene-pass-2.png# edit files in your editor
ucp compile
ucp run-tests --mode edit
ucp logs --count 20ucp logs --count 10
ucp logs --pattern "NullReference|Exception" --count 100
ucp logs --follow --level errorcargo test --manifest-path cli/Cargo.toml
cargo check --manifest-path cli/Cargo.toml
cd website && npm run buildMount the repo-local bridge into a real Unity project:
cargo run --manifest-path cli/Cargo.toml -- --project D:/Unity/Projects/MyGame install --devOr use the helper scripts:
./scripts/smoke-dev.ps1 -Project D:/Unity/Projects/MyGame
./scripts/qa-playground.ps1 -Project unity-project-dev/ucp-dev -TimeoutSeconds 45version.jsonis the metadata source of truthscripts/sync-version.mjs --check <version>validates synced version-bearing files- pushing a tag matching
v*runs.github/workflows/release.yml - the workflow builds Linux, macOS, and Windows binaries
- the same workflow creates the GitHub release and publishes
@mflrevan/ucpto npm - released npm packages bundle the bridge payload
- GitHub release archives include the CLI binary plus
bridge/com.ucp.bridge
cli/ Rust CLI
unity-package/com.ucp.bridge/ Unity Editor bridge package
npm/ npm wrapper and postinstall downloader
docs/ Markdown documentation source
website/ Docs site
skills/ Agent skill files
scripts/ Validation and build helpers
assets/branding/ Shared logo assets
MIT