●NEST — Subagents can now spawn nested subagents up to depth 3 by default, up from 1, making research/build/verify pipelines practical without extra setup●APISKILL — The bundled claude-api skill now defaults to Claude Opus 5, with a documented migration path from Opus 4.8●ENVVAR — ${VAR} entries in managed MCP allowlists and denylists now resolve from the startup environment and managed-settings env, not the settings-file env●A11Y — A screen reader mode lets you follow a session with assistive tech, including announcements of deleted text●VOICE — Voice mode now runs on Opus, Sonnet, and Haiku alike, reaches connected tools like Gmail and Slack, and supports many more languages●TEACH — Claude for Teachers launched on July 14, alongside a $10M commitment to Canadian AI research●NEST — Subagents can now spawn nested subagents up to depth 3 by default, up from 1, making research/build/verify pipelines practical without extra setup●APISKILL — The bundled claude-api skill now defaults to Claude Opus 5, with a documented migration path from Opus 4.8●ENVVAR — ${VAR} entries in managed MCP allowlists and denylists now resolve from the startup environment and managed-settings env, not the settings-file env●A11Y — A screen reader mode lets you follow a session with assistive tech, including announcements of deleted text●VOICE — Voice mode now runs on Opus, Sonnet, and Haiku alike, reaches connected tools like Gmail and Slack, and supports many more languages●TEACH — Claude for Teachers launched on July 14, alongside a $10M commitment to Canadian AI research
Hands-on guide to using Claude Code on real Unity projects: writing CLAUDE.md for Unity, the Unity MCP server, scene-aware C# generation, PlayMode tests, and build verification.
The longer I work in Unity, the more often I think "this would be faster if I just had Claude Code do it." But Unity isn't like web development. Scenes carry state. Asset import settings live outside source files. Build configuration is in .meta files no one wants to read. Claude Code alone hits a wall fast.
This guide collects the techniques I've actually shipped with — and the patterns I've seen burn through credits without producing working code — across several Unity 6 projects with Claude Code v2.
Why Claude Code lands well in Unity, when set up right
Unity development time breaks roughly into four buckets: scene composition, asset tuning, C# implementation, and build verification. C# implementation is the part that maps cleanly to AI-generated code. The same skill set that writes good TypeScript writes good Unity C#.
What makes Unity hard is that writing the script isn't enough. You still need the right GameObject hierarchy, the right SerializeField references wired up, the right Layer and Tag assignments. Code that compiles but isn't wired into the scene does nothing.
Claude Code only really pulls its weight in Unity once you bridge it to the editor itself with the Unity MCP server, which I'll cover below. Before that bridge exists, Unity work with Claude is half automated at best.
Writing CLAUDE.md for a Unity project
The first thing Claude Code reads on startup is CLAUDE.md. Here's an excerpt from the template I'm currently using:
# ProjectVertical-scroll action game on Unity 6.0.x.Targets: iOS / Android (IL2CPP, ARM64).Render pipeline: URP 17.x.Input: Input System Package — do NOT use legacy Input Manager.# Directory layout- Assets/Scripts/Gameplay/ — gameplay logic, MonoBehaviours- Assets/Scripts/Systems/ — persistence, save/load, audio- Assets/Scripts/UI/ — UI Toolkit screens- Assets/_Project/Prefabs/ — player, enemies, items# Coding conventions- using statements: alphabetical- Private fields: _camelCase. Public: PascalCase- async/await: UniTask (Cysharp). Bare Task is forbidden- DOTween: always use SetLink for lifetime safety- Prefer ScriptableObject for tunable values# Tests- PlayMode tests live in Tests/PlayMode/- EditMode tests live in Tests/EditMode/- NUnit + UnityEngine.TestTools assertions
The point is to block web-development assumptions from leaking in. Without "bare Task is forbidden," Claude will happily use await Task.Delay() — which, in Unity, doesn't track the MonoBehaviour lifecycle and keeps running after scene unload. That's a future bug factory.
Calling out URP and the Input System matters too. Skip them and you'll get URP-incompatible shaders and Input.GetKeyDown calls from the legacy input system.
✦
Thank you for reading this far.
Continue Reading
What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.
WHAT YOU'LL LEARN
✦How to write a CLAUDE.md tailored to a Unity project's structure and conventions
✦Automating scene operations with the Unity MCP server
✦An end-to-end loop: Claude generates code, runs PlayMode tests, and verifies builds
Secure payment via Stripe · Cancel anytime
✦
Unlock This Article
Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.
Unity MCP: bringing scene operations into the loop
Unity's MCP (Model Context Protocol) server lets Claude Code drive the editor itself. Concretely, it exposes:
listing GameObjects in the active scene
creating GameObjects, adding components
reading and writing Inspector fields, marking as Prefab
invoking menu commands (e.g., File > Build Settings)
streaming Console logs
Setup goes through Unity Package Manager:
# 1. Add to Packages/manifest.json:{ "dependencies": { "com.unity.mcp.server": "1.x.x" }}# 2. Register the bridge in Claude Code:claude mcp add unity-editor \ --command "node" \ --args "/path/to/unity-mcp-bridge/index.js" \ --env UNITY_PROJECT_PATH=/path/to/your/project
The tool I rely on most heavily is "list scene objects, then read the components on this specific one." Once that exists, the cost of explaining your scene structure to Claude drops to nearly zero.
A real example: "Change the player's move speed from 5.0 to 7.5, and add an accelerometer-based fine adjustment." Claude Code now runs:
Calls unity_get_scene_objects to find the Player
Reads the existing PlayerMovement script
Updates moveSpeed to 7.5
Creates a new IAccelerometerInput interface
Refactors PlayerMovement to use it
Wires up the SerializeField references via Inspector
Runs PlayMode tests to confirm behavior
Zero human intervention until step 7's report. In web terms, that's the difference between "AI writes code" and "AI writes code, deploys to staging, and runs smoke tests."
Tactical tips for higher-quality C# generation
Be explicit about MonoBehaviour lifecycle
MonoBehaviour has many entry points: Awake, Start, OnEnable, Update, FixedUpdate, LateUpdate. Claude leans web — it puts everything in Start. Telling it "init in Awake, register listeners in OnEnable, unregister in OnDisable" sharply improves output quality.
Pin down namespaces
A common failure: it writes using UnityEngine; and forgets UnityEngine.UI or UnityEngine.InputSystem. Document which UI and input frameworks the project uses in CLAUDE.md so the imports come out right.
Push values into ScriptableObjects
Game balance numbers (jump force, enemy HP, item duration) hurt later when they're hardcoded. Tell Claude up front: "Tunable parameters belong in ScriptableObjects, not literals."
Closing the loop on builds
Unity MCP's execute_menu_item lets Claude trigger File > Build And Run. Full device deployment still needs Xcode/Android Studio handoff, but whether the build itself succeeds is automatable.
The loop I run looks like:
1. Claude implements the feature
2. Writes a PlayMode test, verifies in-editor
3. Validates Player Settings via unity_execute_menu_item
4. Pulls Console logs on build error, asks Claude to fix
5. Build And Run on success
After this cycle, the only thing I personally check is how the game feels on the device. Knowing that compile errors will be caught and fixed by AI is, on its own, a different developer experience.
Editor extensions: a surprising sweet spot
Custom editor windows — balancing panels, level editors, debug tools — eat real time in Unity work. Claude Code writes them surprisingly well. Ask for "an EditorWindow that lists enemy ScriptableObjects and lets me edit them in place" and you get appropriate SerializedObject and EditorGUILayout usage out of the box. Think of it as the same thing as asking it to scaffold an admin panel in a web app — it's just an internal tool with different APIs.
Things to avoid
A few patterns to keep away from.
Hand-written HLSL shaders are risky. Skip Shader Graph and ask Claude to write raw HLSL, and you'll get pipeline mismatches and version-specific code that doesn't compile. Build the shader in Shader Graph and let Claude write only the Custom Function Node body.
Don't let Claude bulk-edit asset import settings. A request like "compress all textures to ASTC" via AssetImporter can hit assets you didn't intend. Always narrow the scope first.
Don't ask Claude to edit .unity scene files directly. They're YAML, but they are not human-edit-safe. If Claude proposes editing a .unity file, stop and switch to operating through the editor.
Verifying Without Opening the Editor — Unity Batch Mode
The Unity MCP verification in the previous section assumes the Editor is running. But when I want to fold a compile check into an overnight automation, or just confirm the code compiles without opening the GUI, I reach for a different path.
Unity ships a headless -batchmode that launches from the command line with no editor window. Add -runTests and it will run your EditMode tests headlessly too.
With -quit, Unity closes itself once the run finishes. Any compile error lands in -logFile at that point, so there's no need to open the Editor and read the console by eye.
From Claude Code, the practical move is to wrap this in a thin script and let it run after each change. I keep something like this and call it on every implementation pass.
#!/usr/bin/env bash# run-unity-tests.sh — return only the failures to Claudeset -euo pipefailUNITY="/Applications/Unity/Hub/Editor/6000.0.30f1/Unity.app/Contents/MacOS/Unity""$UNITY" -batchmode -quit -projectPath "$PWD" \ -runTests -testPlatform EditMode \ -testResults "$PWD/TestResults/editmode.xml" \ -logFile "$PWD/Logs/unity-batch.log" || trueif grep -q 'result="Failed"' "$PWD/TestResults/editmode.xml" 2>/dev/null; then echo "=== FAILED TESTS ===" grep -A2 'result="Failed"' "$PWD/TestResults/editmode.xml" exit 1fiecho "All EditMode tests passed."
Only when this returns exit 1 do I hand the failing cases back to Claude Code to fix. Passing just the failures — rather than the whole log every time — keeps the exchange fast and doesn't burn tokens.
I use the two paths for different jobs: MCP verification for "how does this behave inside the Editor right now," and batch mode for "compile and test the logic without opening the Editor at all." Running the Dolice apps solo as an indie developer, that two-tier split is exactly what holds up in overnight automation.
What to do first
If you only try one thing from this guide, install Unity MCP. Everything else can wait. The moment Claude can see and operate the scene, conversations stop being "let me describe the hierarchy" and become "do the thing." That single shift is what makes AI pair programming in Unity feel real.
After that, fill in CLAUDE.md with your project's actual conventions, libraries, and naming rules. The output quality is roughly proportional to how complete that file is.
Share
Thank You for Reading
Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.