Openclaw Unity Plugin 标志

Openclaw Unity Plugin

社区
TomLeeLive

55 MCP tools to drive the Unity Editor from any MCP-compatible AI agent — scenes, GameObjects, prefabs, assets, tests, and builds. OpenClaw gateway included for remote and chat access.

发布者TomLeeLive
代码仓库openclaw-unity-plugin
语言C#
复刻数
7
星标数
107
可用工具
0
传输类型stdio
许可协议Apache-2.0
链接
  • 将工具接入 AI 工作流

    Openclaw Unity Plugin 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 107 个 Star 和 7 个 Fork。

🦞 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!

Unity OpenClaw License Buy Me A Coffee

⚠️ 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

ModeSetup
OpenClawInstall plugin + gateway extension; the gateway's bridge token authenticates the connection
MCPEnable MCP Bridge: Window > OpenClaw > Start MCP Bridge — the panel shows the token file MCP clients read

🔑 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.

VariableEffect
OPENCLAW_CONFIG_DIR / OPENCLAW_HOMEWhere both token files live (default ~/.openclaw)
OPENCLAW_BRIDGE_TOKENUse this token instead of the files, on both sides
OPENCLAW_UNITY_ALLOW_LEGACY_UNAUTHENTICATED=1Restore the pre-1.7.0 open MCP bridge. Off by default; the Editor log and the OpenClaw panel say so loudly while it is on.

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

ComponentVersion
Unity2021.3+
OpenClaw2026.2.3+

⚠️ 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:

Your contributions help make this plugin work across all Unity versions!

Installation

Option 1: Git URL (Recommended)

  1. Open Unity Package Manager (Window > Package Manager)
  2. Click + → Add package from git URL...
  3. Enter:
    https://github.com/TomLeeLive/openclaw-unity-plugin.git

Option 2: Local Package

  1. Clone this repository
  2. In Unity: Window > Package Manager → + → Add package from disk...
  3. Select the package.json file

Quick Start

1. Install OpenClaw Gateway Extension (Required)

Copy the gateway extension files to OpenClaw:

bash
# 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 enables unity_execute and unity_sessions tools. 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

  1. Open Window > OpenClaw Plugin
  2. Set Gateway URL: http://localhost:18789 (default)
  3. Connection is automatic when Unity starts
  4. 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:

bash
# 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

Available Tools (~100 total)

Console (3 tools)

ToolDescription
console.getLogsGet Unity console logs (with type filter)
console.getErrorsGet error/exception logs (with optional warnings)
console.clearClear captured logs

Scene (7 tools)

ToolDescription
scene.listList all scenes in build settings
scene.getActiveGet active scene info
scene.getDataGet scene hierarchy data
scene.loadLoad a scene by name (Play mode)
scene.openOpen a scene in Editor mode
scene.saveSave active scene (Editor mode)
scene.saveAllSave all open scenes (Editor mode)

GameObject (8 tools)

ToolDescription
gameobject.findFind by name, tag, or component type
gameobject.getAllGet all GameObjects with filtering
gameobject.createCreate GameObject or primitive
gameobject.destroyDestroy a GameObject
gameobject.deleteDelete a GameObject (alias for destroy)
gameobject.getDataGet detailed object data
gameobject.setActiveEnable/disable object
gameobject.setParentChange parent

Transform (6 tools)

ToolDescription
transform.getPositionGet world position (x, y, z)
transform.getRotationGet rotation in Euler angles
transform.getScaleGet local scale
transform.setPositionSet world position
transform.setRotationSet rotation (Euler)
transform.setScaleSet local scale

Component

ToolDescription
component.addAdd component to object
component.removeRemove component
component.getGet component data
component.setSet field/property value
component.listList available types

Script (3 tools)

ToolDescription
script.executeExecute code/methods (Debug.Log, Time.timeScale, PlayerPrefs, reflection calls)
script.readRead script file contents
script.listList script files in project

Application

ToolDescription
app.getStateGet play mode, FPS, etc.
app.playEnter play mode (Editor)
app.pauseToggle pause (Editor)
app.stopExit play mode (Editor)

Debug

ToolDescription
debug.logWrite to console
debug.screenshotCapture screenshot (with UI)
debug.hierarchyText hierarchy view

Editor (5 tools)

ToolDescription
editor.refreshRefresh AssetDatabase (triggers recompile)
editor.recompileRequest script recompilation
editor.domainReloadForce domain reload (reinitializes static fields)
editor.focusWindowFocus Editor window (game/scene/console/hierarchy/project/inspector)
editor.listWindowsList all open Editor windows

Input Simulation (NEW in v1.2.0)

ToolDescription
input.keyPressPress and release a key
input.keyDownPress and hold a key
input.keyUpRelease a key
input.typeType text into input field
input.mouseMoveMove mouse cursor
input.mouseClickClick at position
input.mouseDragDrag from A to B
input.mouseScrollScroll wheel
input.getMousePositionGet current cursor position
input.clickUIClick UI element by name

⚠️ 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, use transform.setPosition to move objects directly, or migrate to Unity's new Input System which supports programmatic input injection.

Material (5 tools) - NEW in v1.5.0

ToolDescription
material.createCreate material with shader, color, metallic, smoothness
material.assignAssign material to GameObject
material.modifyModify material properties (color, metallic, emission, etc.)
material.getInfoGet detailed material info with all shader properties
material.listList materials in project with filtering

Prefab (5 tools) - NEW in v1.5.0

ToolDescription
prefab.createCreate prefab from scene GameObject
prefab.instantiateInstantiate prefab in scene with position
prefab.openOpen prefab for editing
prefab.closeClose prefab editing mode
prefab.saveSave currently edited prefab

Asset (7 tools) - NEW in v1.5.0

ToolDescription
asset.findSearch assets by query, type, folder
asset.copyCopy asset to new path
asset.moveMove/rename asset
asset.deleteDelete asset (with trash option)
asset.refreshRefresh AssetDatabase
asset.importImport/reimport specific asset
asset.getPathGet asset path by name

Package Manager (4 tools) - NEW in v1.5.0

ToolDescription
package.addInstall package by name or git URL
package.removeRemove installed package
package.listList installed packages
package.searchSearch Unity package registry

Test Runner (3 tools) - NEW in v1.5.0

ToolDescription
test.runRun EditMode/PlayMode tests with filtering
test.listList available tests
test.getResultsGet last test run results

Batch Execution (1 tool) - NEW in v1.6.0

ToolDescription
batch.executeExecute multiple tools in one call (10-100x performance)

Example:

json
{
  "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

ToolDescription
session.getInfoGet session info (project, processId, machineNa) for multi-instance support

ScriptableObject (6 tools) - NEW in v1.6.0

ToolDescription
scriptableobject.createCreate new ScriptableObject asset
scriptableobject.loadLoad and inspect ScriptableObject fields
scriptableobject.saveSave ScriptableObject changes
scriptableobject.getFieldGet specific field value
scriptableobject.setFieldSet field value with auto-save
scriptableobject.listList ScriptableObjects in project

Shader (3 tools) - NEW in v1.6.0

ToolDescription
shader.listList shaders in project
shader.getInfoGet shader properties and info
shader.getKeywordsGet shader keywords

Texture (5 tools) - NEW in v1.6.0

ToolDescription
texture.createCreate new texture with color fill
texture.getInfoGet texture info (size, format, import settings)
texture.setPixelsFill region with color
texture.resizeResize texture via import settings
texture.listList textures in project

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.

SettingDescriptionDefault
gatewayUrlOpenClaw gateway URLhttp://localhost:18789
apiTokenBridge token override (normally left empty — the gateway's ~/.openclaw/unity-bridge.token is used)(empty)
autoConnectConnect on starttrue
showStatusOverlayShow status in Game viewtrue
captureConsoleLogsCapture logs for AItrue
allowCodeExecutionAllow code executiontrue
allowFileAccessAllow file operationstrue
allowSceneModificationAllow scene changestrue

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

  1. Check Gateway status: openclaw gateway status
  2. Verify URL: default is http://localhost:18789
  3. Check Window > OpenClaw Plugin for errors

Connection lost during Play mode transition

  • Plugin uses SessionState to survive domain reloads
  • Auto-reconnects after Play mode transition
  • If stuck, use editor.refresh or 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.):

Game View ModeScreen LockScreenshot Works?
Play Focused✅ OK✅ Yes
Normal❌ May fail⚠️ Depends

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.refresh or editor.recompile has no effect during Play mode

Solution:

  1. Go to Edit → Project Settings → Editor
  2. Find "Enter Play Mode Settings"
  3. Check ✅ "Reload Domain"

What this does:

SettingReload Domain ONReload Domain OFF
Script changes✅ Applied on Play❌ Ignored until manual refresh
Play mode entry~2-5 seconds~0.5 seconds
Static variablesResetPreserved
Best forDevelopment with active codingTesting/playing without code changes

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:

SettingAI Auto-InvokeUser Explicit Request
false (default)✅ Allowed✅ Allowed
true❌ Blocked✅ Allowed

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.)

yaml
# Example skill metadata
metadata:
  openclaw:
    disableModelInvocation: true  # Recommended for Unity plugin

⚠️ Important Notes

  • Development Only: Disable allowCodeExecution in 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)

将 Openclaw Unity Plugin MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Openclaw Unity Plugin 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 Openclaw Unity Plugin 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Openclaw Unity Plugin MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "openclaw-unity-plugin": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Openclaw Unity Plugin MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Openclaw Unity Plugin MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Openclaw Unity Plugin 帮我完成这项任务吗?
Openclaw Unity Plugin
当然。我已阅读。
以下是我使用 Openclaw Unity Plugin 得到的结果。

常见问题

Openclaw Unity Plugin MCP 服务器有什么用途?

Openclaw Unity Plugin 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Openclaw Unity Plugin MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 Openclaw Unity Plugin,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 Openclaw Unity Plugin MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 Openclaw Unity Plugin 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Openclaw Unity Plugin MCP 连接到 TypingMind?

Openclaw Unity Plugin 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Openclaw Unity Plugin MCP 在 TypingMind 中提供哪些工具?

Openclaw Unity Plugin 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Openclaw Unity Plugin MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 Openclaw Unity Plugin 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇