Skip to content
Back to skills

Unity Game Dev

ASecurity

Use when the user wants to create, set up, or open a Unity project with AI, install the Unity-MCP plugin or its extensions, sign in to ai-game.dev, connect the editor, or wire your coding agent (Claude Code, Codex, Cursor, Gemini CLI) to Unity's MCP tools. Drives unity-mcp-cli end to end.

  • 8 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added August 30, 2026
ai-agentsrustgoc#bashnodeexpressgitapi

Works with

  • claude code
  • cursor
  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned December 2, 2026

npx -y skills add IvanMurzak/ai-game-dev-plugin --skill unity-game-dev --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unity Game Dev?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unity Game Dev
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ivanmurzak-unity-game-dev/badge)](https://www.skillsdirectory.com/skills/ivanmurzak-unity-game-dev)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: unity-game-dev
description: Use when the user wants to create, set up, or open a Unity project with AI, install the Unity-MCP plugin or its extensions, sign in to ai-game.dev, connect the editor, or wire your coding agent (Claude Code, Codex, Cursor, Gemini CLI) to Unity's MCP tools. Drives unity-mcp-cli end to end.
---

# Unity — AI Game Dev runbook

This skill teaches your AI coding assistant (Claude Code, Codex, Cursor or Gemini CLI) to drive **Unity** fully
automatically through the `unity-mcp-cli` npm package. The goal: take the user from nothing to a
running Unity Editor that is **connected to [ai-game.dev](https://ai-game.dev)** so the AI can
build the game for them.

Every command runs via `npx` so nothing needs to be installed globally:

```bash
npx -y unity-mcp-cli@latest <command> [args]     # <command> --help shows every flag
```

## Prerequisites (check first)

- **Node.js 20.19+ or 22.12+** — `node --version`.
- **Unity Hub + a Unity Editor** (e.g. Unity 6). `create-project` and `install-unity` locate Unity
  Hub and install it if it is missing. No editor yet? See step 0.
- **A free ai-game.dev account** — the `login` step signs this machine in.
- **Windows / macOS / Linux** with a real desktop session (the editor opens a window).

## The automatic end-to-end sequence

Run these **in order**. The one ordering rule: the editor must **start after a successful
`login`** (step 4).

### 0. Install a Unity Editor (only if none is installed)

```bash
npx -y unity-mcp-cli@latest install-unity                # latest stable release
npx -y unity-mcp-cli@latest install-unity 6000.3.1f1     # or an exact version
```

Installs the editor through Unity Hub. This is a large download — confirm with the user first.

### 1. Create the project (fresh start only)

Skip this step if the user already has a project — go straight to step 2 pointing at it.

```bash
npx -y unity-mcp-cli@latest create-project "C:/Games/MyGame"
npx -y unity-mcp-cli@latest create-project "C:/Games/MyGame" --unity 6000.3.1f1   # pin a version
```

- Scaffolds a new Unity project at the path with an editor installed in Unity Hub.
- Without `--unity` it uses the **highest installed** editor version.

**Verify:** the path now contains `Assets/`, `Packages/`, and `ProjectSettings/`.

### 2. Install the Unity-MCP plugin

```bash
npx -y unity-mcp-cli@latest install-plugin "C:/Games/MyGame"
```

Adds the Unity-MCP package to `Packages/manifest.json` (latest version unless
`--plugin-version` is given). **Verify:** `Packages/manifest.json` references
`com.ivanmurzak.unity.mcp`.

### 3. Sign in (interactive, once per machine)

```bash
npx -y unity-mcp-cli@latest login
```

- `login` takes **no project path**: it signs in **this machine** and stores the credential in the
  shared machine store `~/.ai-game-dev/credentials.json`, which every engine plugin, CLI, and the
  ai-game.dev desktop app read. If the machine is already signed in it prints
  *Already signed in* and exits — continue.
- Otherwise it starts a **device-code OAuth flow** and prints a **verification URL** and a
  **user code**. **Tell the user** to open the URL in a browser and enter the code.
- **Wait for the command to report success** before continuing.

### 4. (Re)start the editor (auto-connects)

```bash
npx -y unity-mcp-cli@latest close "C:/Games/MyGame"   # no-op when it isn't running; --force if it hangs
npx -y unity-mcp-cli@latest open  "C:/Games/MyGame"
```

The plugin reads the machine credential **once, when the editor starts**. An editor that was
already running when you signed in keeps running without it — so `close` it, then `open`. Run
`open` **only after a successful `login`.** New projects default to **Cloud** mode, so the plugin
connects to ai-game.dev on startup with no extra flag. Unity's first launch imports packages and
compiles; it can take minutes.

### 5. Confirm the connection

```bash
npx -y unity-mcp-cli@latest wait-for-ready "C:/Games/MyGame"
npx -y unity-mcp-cli@latest status         "C:/Games/MyGame"
```

`wait-for-ready` polls the project's MCP server (`/api/system-tools/ping`) until it answers;
default timeout 2 minutes (`--timeout <ms>`, e.g. `--timeout 600000` on a first launch). `status`
then reports whether Unity is running for this project and whether the MCP server is reachable.
**Do not tell the user setup succeeded until `wait-for-ready` passes and `status` shows Unity
running.**

### 6. Wire your AI assistant to the project's MCP tools

Register the project's MCP server with the assistant you are running as, so it can call the
engine's tools directly (create GameObjects, edit scenes, attach components, etc.):

```bash
# Pick the id of the agent you are running as (writes the file shown):
#   claude-code -> .mcp.json        codex  -> .codex/config.toml
#   cursor      -> .cursor/mcp.json gemini -> .gemini/settings.json
npx -y unity-mcp-cli@latest setup-mcp <agent-id> "C:/Games/MyGame"
```

The config is pinned to this project and, in Cloud mode, carries a project key (`--oauth` writes a
URL-only config instead; `--list` shows every agent id). The assistant loads it on its next session
start in the project folder.

### 7. Generate the project's skills (recommended)

```bash
npx -y unity-mcp-cli@latest setup-skills <agent-id> "C:/Games/MyGame"
```

The Unity plugin generates skills for the tools this project actually has (engine version,
installed extensions) and writes them where your agent reads skills: `.claude/skills`,
`.agents/skills`, `.cursor/skills` or `.gemini/skills` (needs the running editor). This runbook only gets the
project connected; those generated skills teach you the engine's tools in depth.

## Optional: extensions and `exec`

```bash
npx -y unity-mcp-cli@latest install-extension --list                   # what can be installed
npx -y unity-mcp-cli@latest install-extension Tilemap "C:/Games/MyGame" # adds the package + OpenUPM registry
npx -y unity-mcp-cli@latest exec --path "C:/Games/MyGame" "UnityEngine.Application.unityVersion"
```

- **Extensions** add tool sets (Animation, Cinemachine, InputSystem, ProBuilder, Tilemap, …).
  Install only what the game needs; Unity resolves the package on its next refresh.
- **`exec`** runs a C# snippet in the editor (the last expression is printed) — handy for a quick
  check or scripted edit. With no editor open it starts a **headless** one and keeps it warm
  (quits after 300 s idle); `close --owned-only "<path>"` stops only an editor the CLI started.

## While building: compile, test, query, unblock

Use these instead of writing your own batch-mode or window-search scripts:

```bash
npx -y unity-mcp-cli@latest compile "C:/Games/MyGame"                  # do the scripts compile? (exit 6: errors)
npx -y unity-mcp-cli@latest test    "C:/Games/MyGame" --mode PlayMode  # batch-mode tests (exit 8: failures)
npx -y unity-mcp-cli@latest rql --path "C:/Games/MyGame" 'editor | select isPlaying isPaused isCompiling'
npx -y unity-mcp-cli@latest dialog  "C:/Games/MyGame"                  # modal dialogs; --press "<button>" answers one
```

- **`compile`** is the proof that a C# change builds: it refreshes assets, waits for the compile and
  the domain reload, and prints errors as `file(line,col)` (`--strict`: warnings fail too). It
  starts a headless editor when none runs.
- **`test`** runs `-runTests` in its own batch-mode editor (`--filter`, `--category`,
  `--assembly`), so it stops with `PROJECT_OPEN` while the editor has the project open: `close` it,
  or run the tests inside it with `run-tool tests-run`.
- **`rql`** reads or changes scenes, objects, assets and editor state (`--schema` lists the
  sources; a query ending in `set` / `call` changes and saves, `--dry-run` previews). The MCP tools
  `rql-query` / `rql-mutate` take the same queries.

Gotchas:

- **A modal dialog blocks the editor**: calls time out although the editor runs (`compile` exits
  18). `dialog` lists it, `dialog --press "<button>"` answers it.
- **Domain reload**: after a script change or entering Play Mode, calls fail for a few seconds
  (HTTP 5xx, connection refused). Run `wait-for-ready` and retry; it is not a failure. Until the
  reload ends the old code runs, so enter Play Mode or test new code only after `compile` succeeds.
- **`screenshot-game-view`** (hidden by default: `run-tool screenshot-game-view`) returns the last
  frame the Game View drew: stale while paused or unfocused. Check `editor | select isPlaying isPaused` first, and trust RQL state over the image.
- **Tools removed in 1.0** (`assets-refresh`, `editor-application-*`, `gameobject-*`, …) are RQL
  now: `editor | call RefreshAssets()`, `editor | set isPlaying = true`
  ([full table](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/default-mcp-tools.md)).

## One-shot summary

```bash
# 1. create (fresh only)  2. install  3. login  4. (re)start  5. verify  6. wire MCP  7. skills
npx -y unity-mcp-cli@latest create-project "C:/Games/MyGame"
npx -y unity-mcp-cli@latest install-plugin "C:/Games/MyGame"
npx -y unity-mcp-cli@latest login                                  # interactive: URL + code
npx -y unity-mcp-cli@latest close          "C:/Games/MyGame"
npx -y unity-mcp-cli@latest open           "C:/Games/MyGame"
npx -y unity-mcp-cli@latest wait-for-ready "C:/Games/MyGame"
npx -y unity-mcp-cli@latest status         "C:/Games/MyGame"
npx -y unity-mcp-cli@latest setup-mcp <agent-id> "C:/Games/MyGame"   # claude-code | codex | cursor | gemini
npx -y unity-mcp-cli@latest setup-skills <agent-id> "C:/Games/MyGame"
```

## Troubleshooting

- **`create-project` fails: no editors / version not found** — install one with
  `install-unity [version]`, or pass a `--unity` version that is installed in the Hub.
- **`login` never completes** — the user has not finished the browser step. Re-print the
  verification URL and code and wait. Ensure the ai-game.dev account is verified.
- **Wrong account / need to sign in again** — `login --force` (add `--yes` to confirm switching
  accounts), then `close` + `open` the editor.
- **Editor runs but doesn't connect** — it started before `login`. `close`, then `open` again.
- **`wait-for-ready` times out** — Unity may still be importing or compiling on first launch.
  Re-run with a longer `--timeout`, and check `status`.

## Golden rules

1. **`login` before the editor starts**; if it was already open, `close` then `open` it.
2. Never declare success until **`wait-for-ready`** passes.
3. `login` is **interactive** — relay the verification URL + code to the user and wait.
4. `login` is machine-wide — never pass it a project path (`--project` is a per-project override).

Learn more at **[ai-game.dev](https://ai-game.dev)**.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.