Unity Editor operations via unity-mcp-client CLI. Handles build verification, console logs, tests, scene/object manipulation. Use after script edits or for debugging.
# Define alias for brevity (all examples below use this)
alias umcp='uvx --from git+https://github.com/bigdra50/unity-mcp-client unity-mcp'
| Command | Purpose |
|---|---|
verify | Full validation (refresh→clear→wait→console) |
refresh | Refresh asset database |
state | Get editor state (isCompiling, isPlaying) |
console | Get console logs |
clear | Clear console |
play / |
stop| Enter/Exit Play Mode |
tests <mode> | Run tests (EditMode/PlayMode) |
config | Show/initialize configuration |
scene <action> | Scene operations |
gameobject <action> | GameObject operations |
material <action> | Material operations |
See references/mcp-commands.md for detailed options.
| Option | Description | Default |
|---|---|---|
--port | MCP server port | Auto-detect (macOS) |
--host | MCP server host | localhost |
--timeout | Max wait for compilation (verify) | 5s |
--connection-timeout | TCP connection timeout (verify) | 30s |
--retry | Max connection retry attempts (verify) | 3 |
--types | Log types (error, warning, log) | error warning |
--count | Number of logs to retrieve | 20 |
After editing C# scripts, shaders, or .asmdef files:
umcp verify # Standard verification
umcp verify --timeout 120 # Extended timeout for large projects
umcp verify --types error warning log # Include all log types
Workflow:
Edit Script → verify → Fix if Errors → Repeat
umcp console --types error # Errors only
umcp console # Errors and warnings (default)
umcp console --types error warning log --count 50 # All logs
umcp tests EditMode # Run EditMode tests
umcp tests PlayMode # Run PlayMode tests
umcp config # Show current configuration
umcp config init # Generate .unity-mcp.toml
umcp config init --output my.toml # Custom output path
umcp config init --force # Overwrite existing
umcp scene active # Get active scene info
umcp scene hierarchy # Get scene hierarchy
umcp scene build-settings # Get scenes in build
umcp scene load --name MainScene # Load by name
umcp scene load --path Assets/Scenes/Level1.unity
umcp scene load --build-index 0 # Load by build index
umcp scene save # Save current scene
umcp scene create --name NewScene --path Assets/Scenes
umcp gameobject find "Main Camera"
umcp gameobject create --name "MyCube" --primitive Cube --position 0,1,0
umcp gameobject modify --name "MyCube" --position 5,0,0 --rotation 0,45,0
umcp gameobject delete --name "MyCube"
Options: --name, --primitive, --position, --rotation, --scale, --parent, --search-method
umcp material info --path Assets/Materials/Default.mat
umcp material create --path Assets/Materials/New.mat --shader Standard
umcp material set-color --path Assets/Materials/New.mat --color 1,0,0,1
umcp material assign --path Assets/Materials/New.mat --target "MyCube"
umcp play # Enter Play Mode
umcp stop # Exit Play Mode
umcp state # Check current state
| Error Type | Identification | Priority |
|---|---|---|
| Compilation (CS####) | CS error codes | Critical |
| Assembly Reference | Missing .asmdef refs | Critical |
| Runtime Exception | NullReference, Missing | High |
| Deprecation Warning | Obsolete API usage | Medium |
Process:
verify to confirmAfter 3 failed attempts, ask user for guidance.
Connection Failures:
--retry for transient failures--port 6400 if auto-detection failsTimeout Issues:
--timeout 120 --connection-timeout 60Use this skill when: