Unity AI Bridge

AI 与智能体

by butterlatte-zhang

通过基于文件的 IPC,让任意 AI IDE 远程控制 Unity Editor,提供 62 个工具且零依赖。

什么是 Unity AI Bridge

通过基于文件的 IPC,让任意 AI IDE 远程控制 Unity Editor,提供 62 个工具且零依赖。

README

English | 中文

Unity AI Bridge

Remote-control the Unity Editor from any AI IDE — no ports, no dependencies, just works.

Unity 2022.3+ License: Apache 2.0 GitHub stars Release Glama

https://github.com/user-attachments/assets/4e8b3f85-b209-406f-a96e-f8b8eddc9160


Why Unity AI Bridge?

Most AI coding assistants can read and write files, but they are blind to the Unity Editor — they can't inspect your scene, tweak materials, run tests, or profile performance. Unity AI Bridge gives AI full editor access.

Key Advantages

  • 65 tools, 15 categories — Scene, GameObject, Assets, Prefab, Script, Profiler, LightProbe, Screenshot, Runtime, Tests, and more. Covers the full editor workflow, not just file I/O.
  • File-based IPC, not WebSocket — No open ports, no firewall issues, no connection drops. Survives recompilation, play-mode transitions, and editor restarts gracefully.
  • Zero external dependencies — Pure Python stdlib CLI/MCP server, self-contained C# Unity package. No pip install, no npm, no Node.js runtime.
  • Every major AI IDE — Claude Code (Skill mode), Cursor, GitHub Copilot, Windsurf, Claude Desktop (MCP mode). One Unity plugin, all IDEs.
  • 5-line extensibility — Add custom tools with [BridgeTool] attribute. Auto-discovered, auto-serialized, auto-documented. No registration code needed.
  • Production-tested — Built for and battle-tested in a large-scale open-world Unity game (50+ developers, 2M+ lines of C#).

vs Unity 6 AI Gateway

Unity 6.2 introduced an official AI Gateway with MCP support. Both projects share the same goal — giving AI agents editor access via MCP — but differ in important ways:

Unity AI BridgeUnity 6 AI Gateway
Unity version2022.3 LTS+6.2+ only
Tool coverage65 tools across 15 categoriesGeneral-purpose (Scene, Assets, Script, Console)
Deep toolingProfiler (snapshot, hotpath, stream), LightProbe, Reflection, Package ManagerNot yet available
IPC mechanismFile polling (~100ms)Unix Socket / Named Pipe
Extensibility[BridgeTool] attribute — 5 linesTBD

In practice, the ~100ms file-polling latency is imperceptible because AI agent think-time dominates each round trip. File IPC also makes cross-process debugging trivial — just inspect the JSON files on disk.


Quick Start

AI-native project — Copy the prompt below and send it to your AI coding assistant. The setup guide is written for AI to follow — you don't need to run any commands yourself.

code
Help me install Unity AI Bridge by following this guide:
https://github.com/butterlatte-zhang/unity-ai-bridge/blob/main/docs/SETUP.md

If you prefer manual setup:

  1. Unity Package — In Unity: Window > Package Manager > + > Add package from git URL:

    code
    https://github.com/butterlatte-zhang/unity-ai-bridge.git?path=Packages/com.aibridge.unity
    

    Or manually copy Packages/com.aibridge.unity from this repo into your project's Packages/ directory.

  2. IDE Integration — Copy .claude/ to your project root, then configure your IDE per docs/SETUP.md.

Supports: Claude Code (Skill mode), Cursor, GitHub Copilot, Windsurf, Claude Desktop (MCP mode).


Tool Categories

65 tools organized into 15 categories:

CategoryCountTools
Scene7scene-open, scene-save, scene-create, scene-list-opened, scene-get-data, scene-set-active, scene-unload
GameObject11gameobject-find, gameobject-create, gameobject-destroy, gameobject-modify, gameobject-duplicate, gameobject-set-parent, gameobject-component-add, gameobject-component-destroy, gameobject-component-get, gameobject-component-list-all, gameobject-component-modify
Assets11assets-find, assets-find-built-in, assets-get-data, assets-modify, assets-move, assets-copy, assets-delete, assets-create-folder, assets-refresh, assets-material-create, assets-shader-list-all
Prefab5assets-prefab-create, assets-prefab-open, assets-prefab-save, assets-prefab-close, assets-prefab-instantiate
Script4script-read, script-update-or-create, script-delete, script-execute
Object2object-get-data, object-modify
Editor4editor-application-get-state, editor-application-set-state, editor-selection-get, editor-selection-set
Reflection2reflection-method-find, reflection-method-call
Screenshot1screenshot-capture
Runtime2runtime-query, runtime-invoke
Console1console-get-logs
Profiler5profiler-snapshot, profiler-stream, profiler-frame-hierarchy, profiler-hotpath, profiler-gc-alloc
Package4package-list, package-search, package-add, package-remove
Light Probe5lightprobe-generate-grid, lightprobe-analyze, lightprobe-bake, lightprobe-clear, lightprobe-configure-lights
Tests1tests-run

Architecture

code
┌──────────────────────────────────────────────────┐
│                   AI IDE                         │
│  (Claude Code / Cursor / Copilot / Windsurf)     │
└──────────┬────────────────────┬──────────────────┘
           │                    │
     Skill mode            MCP mode
           │                    │
           ▼                    ▼
    ┌─────────────┐    ┌──────────────┐
    │  bridge.py  │    │ mcp_server.py│
    │  (Python)   │    │  (Python)    │
    └──────┬──────┘    └──────┬───────┘
           │                  │
           └────────┬─────────┘
                    │
              File-based IPC
            (request / response)
                    │
                    ▼
    ┌───────────────────────────────┐
    │     Unity Editor Plugin      │
    │   (com.aibridge.unity)       │
    │                              │
    │  BridgePlugin ← polls files  │
    │  BridgeToolRegistry          │
    │  BridgeToolRunner            │
    │  [BridgeTool] methods        │
    └───────────────────────────────┘

Dual-channel design: The same Unity plugin serves both Skill mode (direct CLI) and MCP mode (protocol server). Both channels communicate through the same file-based IPC — a pair of request/response files on disk. No network sockets, no port conflicts, no firewall rules.

Why file IPC? Unity's main thread is single-threaded and blocks during domain reload. File polling is the most reliable way to survive recompilation, play-mode transitions, and Editor restarts without losing messages.


Beyond Editing — AI as Game Tester

Most Unity AI tools stop at file editing. Unity AI Bridge goes further — it turns Claude Code (or any AI IDE) into a game testing harness.

CapabilityTraditional AIWith Unity AI Bridge
Write C# code:white_check_mark::white_check_mark:
Check compilation errors:x::white_check_mark: console-get-logs
Enter / exit Play Mode:x::white_check_mark: editor-application-set-state
Trigger game actions:x::white_check_mark: runtime-invoke
Read runtime game state:x::white_check_mark: runtime-query
Take screenshots:x::white_check_mark: screenshot-capture
Full closed loop: Write → Test → Fix → Repeat:x::white_check_mark:

AI Playtest Loop

code
AI writes code → compiles → enters Play Mode → observes state → judges → fixes → repeats
     ↑                                                                         │
     └─────────────────── fully automated loop ────────────────────────────────┘

The pattern: Act → Wait → Observe → Judge → Repeat

  • Act: runtime-invoke calls static methods to trigger game actions
  • Wait: wait_playmode.py / wait_compile.py handle timing
  • Observe: runtime-query reads MonoBehaviour fields + screenshot-capture for visuals
  • Judge: AI analyzes state/screenshots to decide PASS/FAIL

Auto-Playtest Example | AI Closed-Loop Guide | Playtest Tool Reference


Add Your Own Tools

Expose any static method to AI with a single attribute:

csharp
using UnityAiBridge;

[BridgeToolType]
public static partial class CustomTools
{
    [BridgeTool("custom-greet")]
    [System.ComponentModel.Description("Say hello")]
    public static string Greet(string name = "World")
    {
        return $"Hello, {name}!";
    }
}

The bridge discovers tools at Editor startup via reflection. No registration code, no config files. Parameters are automatically mapped to JSON Schema for the AI to call.


Security

Unity AI Bridge runs entirely on your local machine. The file IPC channel is scoped to your user's temp directory, and no network listeners are opened.

See SECURITY.md for details.


Compatibility

Unity VersionRender PipelineStatus
2022.3 LTS+Built-inSupported
2022.3 LTS+URPSupported
2022.3 LTS+HDRPSupported
6000.x (Unity 6)AllSupported

Platforms: Windows, macOS


Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

  • Report bugs and request features via GitHub Issues
  • Submit pull requests against the main branch
  • Add new tools by following the [BridgeTool] pattern above

Acknowledgments

Unity AI Bridge is derived from Unity-MCP by Ivan Murzak (Apache License 2.0). See THIRD_PARTY_NOTICES.md for details.

License

Apache License 2.0

常见问题

Unity AI Bridge 是什么?

通过基于文件的 IPC,让任意 AI IDE 远程控制 Unity Editor,提供 62 个工具且零依赖。

相关 Skills

Claude接口

by anthropics

Universal
热门

面向接入 Claude API、Anthropic SDK 或 Agent SDK 的开发场景,自动识别项目语言并给出对应示例与默认配置,快速搭建 LLM 应用。

想把Claude能力接进应用或智能体,用claude-api上手快、兼容Anthropic与Agent SDK,集成路径清晰又省心

AI 与智能体
未扫描111.8k

计算机视觉

by alirezarezvani

Universal
热门

聚焦目标检测、图像分割与视觉系统落地,覆盖 YOLO、DETR、Mask R-CNN、SAM 等方案,适合定制数据集训练、推理优化及 ONNX/TensorRT 部署。

把目标检测、图像分割到推理部署串成完整工程链路,主流框架与 YOLO、DETR、SAM 等方案都覆盖,落地视觉 AI 会省心很多。

AI 与智能体
未扫描9.8k

智能体流程设计

by alirezarezvani

Universal
热门

面向生产级多 Agent 编排,梳理顺序、并行、分层、事件驱动、共识五种工作流设计,覆盖 handoff、状态管理、容错重试、上下文预算与成本优化,适合搭建复杂 AI 协作系统。

帮你把多智能体流程设计、编排和自动化统一起来,复杂工作流也能更稳地落地,适合追求强控制力的团队。

AI 与智能体
未扫描9.8k

相关 MCP Server

知识图谱记忆

编辑精选

by Anthropic

热门

Memory 是一个基于本地知识图谱的持久化记忆系统,让 AI 记住长期上下文。

帮 AI 和智能体补上“记不住”的短板,用本地知识图谱沉淀长期上下文,连续对话更聪明,数据也更可控。

AI 与智能体
83.1k

顺序思维

编辑精选

by Anthropic

热门

Sequential Thinking 是让 AI 通过动态思维链解决复杂问题的参考服务器。

这个服务器展示了如何让 Claude 像人类一样逐步推理,适合开发者学习 MCP 的思维链实现。但注意它只是个参考示例,别指望直接用在生产环境里。

AI 与智能体
83.1k

PraisonAI

编辑精选

by mervinpraison

热门

PraisonAI 是一个支持自反思和多 LLM 的低代码 AI 智能体框架。

如果你需要快速搭建一个能 24/7 运行的 AI 智能体团队来处理复杂任务(比如自动研究或代码生成),PraisonAI 的低代码设计和多平台集成(如 Telegram)让它上手极快。但作为非官方项目,它的生态成熟度可能不如 LangChain 等主流框架,适合愿意尝鲜的开发者。

AI 与智能体
6.8k

评论