🦞 OpenClaw Unity Plugin
TL;DR: Vibe-code your game development remotely from anywhere! 🌍
한줄요약: 이제 집밖에서도 원격으로 바이브코딩으로 게임 개발 가능합니다! 🎮
Connect Unity to OpenClaw AI assistant via HTTP. Works in Editor mode without hitting Play!
⚠️ Disclaimer
This software is in beta. Use at your own risk.
- Always backup your project before using
- Test in a separate project first
- The authors are not responsible for any data loss or project corruption
See LICENSE for full terms.
🔀 Hybrid Architecture
This plugin supports two connection modes - use whichever fits your workflow:
Mode A: OpenClaw Gateway (Remote Access)
Telegram/Discord/Web → OpenClaw Gateway → Unity Plugin
- ✅ Remote access from anywhere
- ✅ Chat integration (Telegram, Discord, etc.)
- ✅ Cron jobs, automation, multi-device
- ⚠️ Requires OpenClaw Gateway running
Mode B: MCP Direct (Local Development)
Claude Code/Desktop → MCP Server → Unity Plugin
- ✅ Direct connection, no middleware
- ✅ Works with Claude Code, Cursor, etc.
- ✅ Lower latency for local development
- ⚠️ Local only (127.0.0.1)
Quick Setup
🔑 Bridge authentication (v1.7.0)
Both local bridges are authenticated with a per-launch secret. Neither accepts an anonymous caller any more, and neither answers a browser.
Gateway bridge — this add-on is the client. When the OpenClaw gateway loads
the Unity extension it writes a random 32-byte token to
~/.openclaw/unity-bridge.token with mode 0600. This add-on reads it and sends
it as X-OpenClaw-Bridge-Token on POST /unity/register; the gateway answers
with a per-session token that every later request carries as
X-OpenClaw-Session. Each command the gateway queues has a nonce, and this
add-on echoes that nonce with the result, so no other local process can answer in
its place.
MCP bridge — this add-on is the server. When the bridge starts it generates a
per-launch token and writes it to ~/.openclaw/unity-mcp-bridge.token with mode
0600. MCP~/index.js reads that file and sends it as X-OpenClaw-Token. Every
request needs it (401 otherwise), the listener binds 127.0.0.1 only, requests
carrying Origin or Referer are refused with 403, and no CORS headers are sent
— before 1.7.0 it replied Access-Control-Allow-Origin: *, which let any open web
page run Editor tools including script.execute.
Tokens are never written to the Unity console — only the token file's path is.
The 0600 file keeps other users out; a process running as you can read it,
which is the same boundary that protects your SSH keys.
📖 Setup Guide | 셋업 가이드
✨ Key Features
- 🎮 Works in Editor & Play Mode - No need to hit Play to use AI tools
- 🔌 Auto-Connect - Connects when Unity starts, maintains connection across mode changes
- 📋 Console Integration - Capture and query Unity logs for debugging
- 🎬 Scene Management - List, load, and inspect scenes
- 🔧 Component Editing - Add, remove, and modify component properties
- 📸 Debug Tools - Screenshots, hierarchy view, and more
- 🎯 Input Simulation - Keyboard, mouse, and UI interaction for game testing
- 🔄 Editor Control - Trigger recompilation and asset refresh remotely
- 🔒 Security Controls - Configure what operations are allowed
Requirements
⚠️ Tested on Unity 6000.3 (Unity 6.3 LTS) only.
While designed for Unity 2021.3+, this plugin has only been tested on Unity 6000.3.7f1 (Unity 6.3 LTS). If you encounter issues on other Unity versions, please:
- 🐛 Open an Issue with your Unity version and error details
- 🔧 Submit a Pull Request if you have a fix
Your contributions help make this plugin work across all Unity versions!
Installation
Option 1: Git URL (Recommended)
- Open Unity Package Manager (
Window > Package Manager) - Click
+→Add package from git URL... - Enter:
https://github.com/TomLeeLive/openclaw-unity-plugin.git
Option 2: Local Package
- Clone this repository
- In Unity:
Window > Package Manager→+→Add package from disk... - Select the
package.jsonfile
Quick Start
1. Install OpenClaw Gateway Extension (Required)
Copy the gateway extension files to OpenClaw:
# Copy extension files
cp -r OpenClawPlugin~/* ~/.openclaw/extensions/unity/
# Restart gateway to load the extension
openclaw gateway restart
# Verify
openclaw unity status
Note:
OpenClawPlugin~contains the gateway extension that enablesunity_executeandunity_sessionstools. This is required for OpenClaw to communicate with Unity.
2. Install Unity Package
See Installation above for Git URL or local package setup.
3. Configure in Unity
- Open
Window > OpenClaw Plugin - Set Gateway URL:
http://localhost:18789(default) - Connection is automatic when Unity starts
- Status shows green when connected
4. Chat with OpenClaw
Ask OpenClaw to inspect your scene, create objects, or debug issues - all without entering Play mode!
5. Install OpenClaw Skill (Optional)
The companion skill provides workflow patterns and tool references for the AI:
# Clone skill to OpenClaw workspace
git clone https://github.com/TomLeeLive/openclaw-unity-skill.git ~/.openclaw/workspace/skills/unity-plugin
The skill provides:
- Quick reference for all 55 tools
- Common workflow patterns (scene inspection, UI testing, etc.)
- Detailed parameter documentation
- Troubleshooting guides
Note: The skill is separate from the gateway extension. The extension enables the tools; the skill teaches the AI how to use them effectively.
📚 Documentation
- Development Guide - Architecture, extending tools, and contribution guidelines
- Testing Guide - Complete testing guide with examples
Available Tools (~100 total)
Console (3 tools)
Scene (7 tools)
GameObject (8 tools)
Transform (6 tools)
Component
Script (3 tools)
Application
Debug
Editor (5 tools)
Input Simulation (NEW in v1.2.0)
⚠️ Input Simulation Limitation: Keyboard/mouse simulation works for UI interactions (Button clicks, InputField typing) but NOT for gameplay input using
Input.GetKey()or legacy Input Manager. This is a Unity limitation -Input.GetKey()reads directly from the OS input buffer. For automated gameplay testing, usetransform.setPositionto move objects directly, or migrate to Unity's new Input System which supports programmatic input injection.
Material (5 tools) - NEW in v1.5.0
Prefab (5 tools) - NEW in v1.5.0
Asset (7 tools) - NEW in v1.5.0
Package Manager (4 tools) - NEW in v1.5.0
Test Runner (3 tools) - NEW in v1.5.0
Batch Execution (1 tool) - NEW in v1.6.0
Example:
{
"commands": [
{ "tool": "scene.getActive", "params": {} },
{ "tool": "gameobject.find", "params": { "name": "Player" } },
{ "tool": "debug.screenshot", "params": {} }
],
"stopOnError": false
}
Session Info (1 tool) - NEW in v1.6.0
ScriptableObject (6 tools) - NEW in v1.6.0
Shader (3 tools) - NEW in v1.6.0
Texture (5 tools) - NEW in v1.6.0
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Unity Editor │
│ │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ OpenClawEditorBridge │ │
│ │ [InitializeOnLoad] │ │
│ │ │ │
│ │ • EditorApplication.delayCall → safe init │ │
│ │ • EditorApplication.update → connection polling │ │
│ │ • SessionState → survives Play mode transitions │ │
│ └──────────────────────┬─────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ OpenClawConnectionManager │ │
│ │ (Singleton - shared across modes) │ │
│ │ │ │
│ │ • HTTP polling for commands │ │
│ │ • Main thread execution queue │ │
│ │ • Automatic reconnection │ │
│ │ • JSON parsing with nested object support │ │
│ └──────────────────────┬─────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ OpenClawTools (~80 tools) │ │
│ │ │ │
│ │ • Scene/GameObject/Component manipulation │ │
│ │ • Debug tools (screenshot, hierarchy) │ │
│ │ • Input simulation (keyboard, mouse, UI) │ │
│ │ • Editor control (recompile, refresh) │ │
│ └────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────┘
│
│ HTTP
▼
┌──────────────────────────────────────────────────────────────┐
│ OpenClaw Gateway │
│ http://localhost:18789 │
│ │
│ Endpoints: │
│ • POST /unity/register - Register Unity session │
│ • POST /unity/heartbeat - Keep session alive │
│ • GET /unity/poll - Poll for commands │
│ • POST /unity/result - Send tool execution results │
└──────────────────────────────────────────────────────────────┘
Configuration
Create via Assets > Create > OpenClaw > Config and place in Resources folder.
Example Usage
Scene Inspection
You: What GameObjects are in my scene?
OpenClaw: [Executes debug.hierarchy]
Your scene has:
▶ Main Camera [Camera, AudioListener]
▶ Directional Light [Light]
▶ Player [PlayerController, Rigidbody]
▶ Model [MeshRenderer]
▶ UI Canvas [Canvas, GraphicRaycaster]
▶ PlayButton [Button]
Game Testing with Input Simulation
You: Test the login flow - enter username "TestPlayer" and click Play
OpenClaw:
[Executes input.clickUI {name: "UsernameInput"}]
[Executes input.type {text: "TestPlayer"}]
[Executes input.clickUI {name: "PlayButton"}]
[Executes debug.screenshot]
Done! Clicked username input, typed "TestPlayer", and clicked Play button.
Screenshot attached showing the result.
Remote Recompilation
You: I updated the PlayerController script, recompile Unity
OpenClaw: [Executes editor.recompile]
Script recompilation requested. Unity will reload shortly.
Troubleshooting
Bridge won't connect
- Check Gateway status:
openclaw gateway status - Verify URL: default is
http://localhost:18789 - Check
Window > OpenClaw Pluginfor errors
Connection lost during Play mode transition
- Plugin uses
SessionStateto survive domain reloads - Auto-reconnects after Play mode transition
- If stuck, use
editor.refreshor click "Force Reconnect"
Screenshot shows wrong content
- In Play mode: Uses
ScreenCapture(includes UI) - In Editor mode: Uses
Camera.main.Render()(no overlay UI) - Use Play mode for accurate game screenshots
Screen Lock / Remote Access
When using debug.screenshot remotely (via SSH, screen sharing, etc.):
Best Practice: Set Game View to "Play Focused" mode before locking the screen. This ensures Unity keeps rendering the game even when the window isn't visible.
To enable: Click the dropdown next to "Scale" in Game View → Select "Play Focused"
Script changes not applied after Play mode restart
Unity's "Enter Play Mode Settings" can skip domain reload for faster iteration, but this prevents script recompilation.
Symptoms:
- Code changes don't take effect when re-entering Play mode
- Old behavior persists despite saving scripts
editor.refreshoreditor.recompilehas no effect during Play mode
Solution:
- Go to
Edit → Project Settings → Editor - Find "Enter Play Mode Settings"
- Check ✅ "Reload Domain"
What this does:
Tip: Keep "Reload Domain" ON during development. Only disable it when you need fast iteration without code changes.
🔐 Security: Model Invocation Setting
When publishing to ClawHub or installing as a skill, you can configure disableModelInvocation in the skill metadata:
Recommendation for Unity Plugin: true
Reason: During Unity development, it's useful for AI to autonomously perform supporting tasks like checking scene hierarchy, taking screenshots, and inspecting GameObjects.
When to use true: For sensitive tools (payments, deletions, message sending, etc.)
# Example skill metadata
metadata:
openclaw:
disableModelInvocation: true # Recommended for Unity plugin
⚠️ Important Notes
- Development Only: Disable
allowCodeExecutionin production builds - TextMeshPro: Plugin works with or without TMPro (uses reflection)
- Unity 6: Deferred initialization prevents UPM EPIPE crashes
🎭 AI Personas for Game Development
Want your AI agent to have a consistent personality while developing your game? ClawSouls provides open-source persona packages (Soul Spec) that work with OpenClaw and other AI frameworks. Give your coding assistant a specialized game dev personality, or create custom NPC behavior profiles.
- Browse community souls: clawsouls.ai
- Soul Spec standard: soulspec.org
- Quick start:
npx clawsouls init my-game-dev --spec 0.4
Changelog
See CHANGELOG.md for version history.
License
MIT License - See LICENSE
Made with 🦞 by the OpenClaw community
License
This project has been licensed under Apache-2.0 since its initial release. Copyright 2026 Tom Lee (TomLeeLive)