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.

106
Stars
7
Forks
C#
语言
2026/8/24
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/TomLeeLive/openclaw-unity-plugin

快速入门

使用 openclaw-unity-plugin 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

🦞 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
OpenClawJust install plugin, Gateway handles connection
MCPEnable MCP Bridge: Window > OpenClaw > Start MCP Bridge

📖 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:

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

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

{
  "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
apiTokenOptional API token(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.)

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

常见问题

What is openclaw-unity-plugin?

openclaw-unity-plugin is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by 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. It has 106 GitHub stars.

Is openclaw-unity-plugin safe to use?

Yes. openclaw-unity-plugin passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install openclaw-unity-plugin?

Clone the repository with "git clone https://github.com/TomLeeLive/openclaw-unity-plugin" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is openclaw-unity-plugin written in?

openclaw-unity-plugin is primarily written in C#. It is open-source under TomLeeLive on GitHub, so you can review or fork the full source.

Are there alternatives to openclaw-unity-plugin?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh openclaw-unity-plugin against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情