dsh-unity-mcp-bridge 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/README.zh.md +4 -2
- package/docs/DETAILS.md +22 -11
- package/lib/index.js +32 -11
- package/package.json +2 -2
- package/skills/unity-mcp-check/SKILL.md +72 -120
- package/skills/unity-mcp-install/SKILL.md +16 -16
- package/skills/{SKILL.md → unity-mcp-tools/SKILL.md} +59 -54
- package/skills/unity-mcp-tools/reference/extensions.md +118 -0
- package/skills/{reference → unity-mcp-tools/reference}/package-manager.md +1 -1
- package/skills/unity-mcp-tools/reference/rql.md +131 -0
- package/skills/{reference → unity-mcp-tools/reference}/screenshot.md +1 -1
- package/skills/{reference → unity-mcp-tools/reference}/script.md +3 -3
- package/skills/{reference → unity-mcp-tools/reference}/tests.md +9 -9
- package/skills/unity-mcp-tools/reference/tool.md +15 -0
- package/skills/unity-mcp-update/SKILL.md +212 -0
- package/skills/unity-mcp-update-tools/SKILL.md +115 -0
- package/tools/generate-unity-mcp-catalog.ps1 +84 -20
- package/vendor/README.md +12 -8
- package/vendor/SHA256SUMS-9.3.0 +7 -0
- package/vendor/com.ivanmurzak.unity.mcp-1.6.0.tgz +0 -0
- package/vendor/manifest.json +17 -17
- package/skills/reference/rql.md +0 -86
- package/skills/reference/tool.md +0 -12
|
@@ -27,7 +27,7 @@ if ($cli) { unity-mcp-cli --version } else { 'NOT INSTALLED' }
|
|
|
27
27
|
- 打印 `NOT INSTALLED` → 走第 2 步。
|
|
28
28
|
- 命令在但执行报错,或怀疑「装了但不在 PATH」:`npm ls -g unity-mcp-cli`(全局 bin 目录一般是 `%APPDATA%\npm`)。
|
|
29
29
|
|
|
30
|
-
**版本对齐(必查,别只看「能不能跑」)**:CLI、Unity 插件、MCP Server 三者版本是 lockstep 的 —— 实测 `unity-mcp-cli 1.2.0` ↔ 插件 `com.ivanmurzak.unity.mcp@1.2.0` ↔ Server `9.2.11`(CLI 的 `dist/utils/server-version.js` 里 `DEFAULT_SERVER_VERSION` 就是插件 `McpServerManager.ServerVersion` 的镜像)。**插件钉住哪个 Server,以插件源码为准,不要猜**:1.5.0 的 tarball 里 `Editor/Scripts/McpServerManager.cs` 写死 `public const string ServerVersion = "9.2.17"`。升到 CLI 1.5.0 后实测两边同步了:`DEFAULT_SERVER_VERSION` 也是 **9.2.17**;而 `install-plugin` 到 1.5.0 **仍然没有** `--plugin-source`(离线只能走 5.2 的 `file:`
|
|
30
|
+
**版本对齐(必查,别只看「能不能跑」)**:CLI、Unity 插件、MCP Server 三者版本是 lockstep 的 —— 实测 `unity-mcp-cli 1.2.0` ↔ 插件 `com.ivanmurzak.unity.mcp@1.2.0` ↔ Server `9.2.11`(CLI 的 `dist/utils/server-version.js` 里 `DEFAULT_SERVER_VERSION` 就是插件 `McpServerManager.ServerVersion` 的镜像)。**插件钉住哪个 Server,以插件源码为准,不要猜**:1.5.0 的 tarball 里 `Editor/Scripts/McpServerManager.cs` 写死 `public const string ServerVersion = "9.2.17"`。升到 CLI 1.5.0 后实测两边同步了:`DEFAULT_SERVER_VERSION` 也是 **9.2.17**;而 `install-plugin` 到 1.5.0 **仍然没有** `--plugin-source`(离线只能走 5.2 的 `file:` 依赖)。一条命令把四层(上游最新 / 本地离线包 / 项目已装 / 本机 CLI)全查出来(只为安装时对齐版本;单独查更新/升级用 `/unity-mcp-update`):
|
|
31
31
|
|
|
32
32
|
```powershell
|
|
33
33
|
# <bridge> = 插件目录:源码目录,或已安装副本 %DSH_PROFILE_DIR%\node_modules\dsh-unity-mcp-bridge
|
|
@@ -35,7 +35,7 @@ $env:HTTPS_PROXY = 'http://127.0.0.1:7897'; $env:NODE_USE_ENV_PROXY = '1' #
|
|
|
35
35
|
node "<bridge>\tools\offline-package.mjs" check --cli-version (unity-mcp-cli --version)
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
老 CLI 的 **AI agent 列表会缺项**:实测 0.91.0、1.2.0 与 1.5.0 的 `setup-mcp --list` 都只有 14 个 agent,**不含 `kilo-code`**;而 Server 自己的 `configure --help` 有 16 个(含 `kilo-code`、`zoo-code`、`other-custom
|
|
38
|
+
老 CLI 的 **AI agent 列表会缺项**:实测 0.91.0、1.2.0 与 1.5.0 的 `setup-mcp --list` 都只有 14 个 agent,**不含 `kilo-code`**;而 Server 自己的 `configure --help` 有 16 个(含 `kilo-code`、`zoo-code`、`other-custom`)。所以要把 AI agent 配成 Kilo Code 时,CLI 再新也用不了 `setup-mcp`,必须 `configure --agent`。
|
|
39
39
|
|
|
40
40
|
```powershell
|
|
41
41
|
npm view unity-mcp-cli version # registry 上的最新版
|
|
@@ -91,12 +91,12 @@ Get-ChildItem (Join-Path $proj 'Library\PackageCache') -Directory -Filter 'com.i
|
|
|
91
91
|
unity-mcp-cli install-plugin $proj --with-server
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
**默认就带 `--with-server`**:它把与本机 RID 匹配的 `GameDev-MCP-Server` 二进制装进 CLI 的**托管目录** `~\.ai-game-dev\server\<rid>\`(含 `version`
|
|
94
|
+
**默认就带 `--with-server`**:它把与本机 RID 匹配的 `GameDev-MCP-Server` 二进制装进 CLI 的**托管目录** `~\.ai-game-dev\server\<rid>\`(含 `version` 标记文件)。`configure --agent <id>`(给 Unity 里选中的 AI agent 写客户端配置,如 Kilo Code 的 `.kilocode/mcp.json`)就是靠这个二进制跑起来的(`proxyConfigure` 直接执行 `<托管 exe> configure --agent <id> [--url …]`,cwd = 项目根),缺它就只能退回项目自带的 `Library\mcp-server\<rid>\gamedev-mcp-server.exe`。
|
|
95
95
|
|
|
96
96
|
| 开关 | 用途 |
|
|
97
97
|
|---|---|
|
|
98
|
-
| `--with-server` | 同时下载 GameDev-MCP-Server 二进制(CLI 1.
|
|
99
|
-
| `--server-version <version>` | 指定要下载的 Server 版本(CLI 1.
|
|
98
|
+
| `--with-server` | 同时下载 GameDev-MCP-Server 二进制(CLI 1.6.0 默认 **9.3.0**,与插件 `McpServerManager.ServerVersion` 同步;1.2.0 时代是 9.2.11) |
|
|
99
|
+
| `--server-version <version>` | 指定要下载的 Server 版本(CLI 1.6.0 默认 9.3.0) |
|
|
100
100
|
| `--server-source <path-or-url>` | 离线兜底:从本地 zip 或 URL 装 Server(**跳过 SHA256SUMS 校验**,自己核对哈希) |
|
|
101
101
|
| `--plugin-version <version>` | 指定插件版本(默认 latest;离线/代理场景下显式指定可省掉一次 OpenUPM 解析) |
|
|
102
102
|
| `--enroll <code>` / `--enroll-stdin` | 兑换云端 enrollment code(用自建本地端点时不需要) |
|
|
@@ -167,26 +167,26 @@ ERROR: fetch failed
|
|
|
167
167
|
|
|
168
168
|
### 5.2 离线本地包(插件自带 `vendor/`;给「新的 Unity 工程」用时优先走这条)
|
|
169
169
|
|
|
170
|
-
插件目录下的 `vendor/` 是一份离线包缓存:`vendor/README.md`(版本/大小/SHA256/来源)+ `vendor/manifest.json`(机器可读)。当前内容:插件 `com.ivanmurzak.unity.mcp@1.
|
|
170
|
+
插件目录下的 `vendor/` 是一份离线包缓存:`vendor/README.md`(版本/大小/SHA256/来源)+ `vendor/manifest.json`(机器可读)。当前内容:插件 `com.ivanmurzak.unity.mcp@1.6.0`(960,306 B,SHA256 `13fd2579…c5178b`)与 Server `9.3.0` win-x64(44,088,479 B,SHA256 `53a79b42…e01dc2f`,已对官方 `SHA256SUMS` 校验通过)。
|
|
171
171
|
|
|
172
172
|
```powershell
|
|
173
173
|
# 1) 把工程依赖指向本地 tarball(先 --dry-run 看 diff;正式跑会自动备份 manifest)
|
|
174
174
|
node "<bridge>\tools\offline-package.mjs" install --project $proj
|
|
175
175
|
|
|
176
176
|
# 2) Server 也从 vendor 的 zip 装进 CLI 托管目录(不联网)
|
|
177
|
-
unity-mcp-cli install-plugin $proj --with-server --server-version 9.
|
|
178
|
-
--server-source "<bridge>\vendor\gamedev-mcp-server-win-x64-9.
|
|
177
|
+
unity-mcp-cli install-plugin $proj --with-server --server-version 9.3.0 `
|
|
178
|
+
--server-source "<bridge>\vendor\gamedev-mcp-server-win-x64-9.3.0.zip"
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
要点(都实测过):
|
|
182
182
|
|
|
183
|
-
- `install-plugin` **没有** `--plugin-source`。离线靠的是 Unity 官方支持的本地 tarball 依赖:`"com.ivanmurzak.unity.mcp": "file:D:/…/vendor/com.ivanmurzak.unity.mcp-1.
|
|
183
|
+
- `install-plugin` **没有** `--plugin-source`。离线靠的是 Unity 官方支持的本地 tarball 依赖:`"com.ivanmurzak.unity.mcp": "file:D:/…/vendor/com.ivanmurzak.unity.mcp-1.6.0.tgz"`(Unity 手册 *Local folder or tarball paths*:`file:` 允许绝对路径,Windows 用正斜杠)。
|
|
184
184
|
- 之后再跑 `unity-mcp-cli install-plugin` **不会**把它改回版本号:CLI 的 `shouldUpdateVersion` 对 `file:` / `git+` / `http:` 开头的依赖直接跳过(`dist/utils/manifest.js` 的 `nonSemverPrefixes`)。实测那行保持 `file:` 不变。
|
|
185
|
-
- 目标版本从哪来:`vendor/manifest.json` 的 `plugin.pinnedServerVersion` —— 脚本从 tarball 里的 `Editor/Scripts/McpServerManager.cs` 读 `ServerVersion` 常量(1.
|
|
186
|
-
- 完全离线还剩一个小尾巴:插件的传递依赖 `extensions.unity.playerprefsex
|
|
187
|
-
- `file:` 依赖**不会自动升级**:升级 = 重新 `fetch` + 重新 `install
|
|
185
|
+
- 目标版本从哪来:`vendor/manifest.json` 的 `plugin.pinnedServerVersion` —— 脚本从 tarball 里的 `Editor/Scripts/McpServerManager.cs` 读 `ServerVersion` 常量(1.6.0 钉住 **9.3.0**)。别拿「Server 上游最新」当目标。
|
|
186
|
+
- 完全离线还剩一个小尾巴:插件的传递依赖 `extensions.unity.playerprefsex` 要 Unity 的 Package Manager 从 OpenUPM 解析(实测 OpenUPM 直连可达)。彻底断网的机器要么预先让 Unity 解析过一次,要么接受首次解析需要联网。
|
|
187
|
+
- `file:` 依赖**不会自动升级**:升级 = 重新 `fetch` 刷新本地离线包 + 重新 `install` 进工程(见 `/unity-mcp-update` 的 4.2 / 4.3),换版本后照例重生成命令目录。
|
|
188
188
|
- 换平台:`node "<bridge>\tools\offline-package.mjs" fetch --rid osx-arm64` 先补对应 zip,再 `--server-source` 指过去。
|
|
189
|
-
- **profile 里的安装副本常常缺 zip**:
|
|
189
|
+
- **profile 里的安装副本常常缺 zip**:40 MB 级二进制不进 git/npm,`dsh plugin add file:…` 装出来的 `node_modules\dsh-unity-mcp-bridge\vendor\` 通常只有 tarball + manifest。`install` 会明确告诉你缺不缺;缺就先 `fetch`(代理优先)补齐再跑 `--server-source`,不要拿旧版本的 zip 顶。
|
|
190
190
|
|
|
191
191
|
## 6. 验证与下一步
|
|
192
192
|
|
|
@@ -206,12 +206,12 @@ Push-Location $proj; & "$env:USERPROFILE\.ai-game-dev\server\win-x64\gamedev-mcp
|
|
|
206
206
|
|
|
207
207
|
1. 用 Unity 打开该项目(`unity-mcp-cli open $proj`)—— 包在编辑器里解析,`Library/PackageCache/` 才会出现。
|
|
208
208
|
2. 在 Unity 里打开 **Window → AI Game Developer**,确认连接方式(自建本地端点选 Custom,或走 Cloud),并把顶部的 **AI agent** 选成要用的那个(如 **Kilo Code**)—— Skills 的自动生成只认这个下拉框,CLI 的 `setup-skills` 不支持 `kilo-code`。
|
|
209
|
-
3. 回到 DSH 跑 `/unity-mcp-check
|
|
210
|
-
4. **本次装了或升级了插件版本 → 必须重生成桥接自带的命令目录**,否则 `/unity-mcp-tools`
|
|
209
|
+
3. 回到 DSH 跑 `/unity-mcp-check`:它会检查插件是否装上、端口是否 **20000**、DSH 是否加载了插件行、工具集是否只剩 `tool-set-enabled-state`、命令目录是否与插件版本一致,最后实测连通。要查版本或升级用 `/unity-mcp-update`(检查后先问用户,同意才更新)。
|
|
210
|
+
4. **本次装了或升级了插件版本 → 必须重生成桥接自带的命令目录**,否则 `/unity-mcp-tools` 会教模型去开不存在的命令(顺带刷新 `reference/extensions.md` 的可选扩展清单;也可以直接跑 `/unity-mcp-update-tools`)。命令名随插件版本变(实测 0.9x = 73 个;1.2.0 = 18 个;**分水岭是 1.0.0「RQL replaces the data tools」**,`assets-*` / `gameobject-*` / `scene-*` / `profiler-*` 等已被 `rql-query` / `rql-mutate` / `rql-schema` 取代):
|
|
211
211
|
|
|
212
212
|
```powershell
|
|
213
213
|
# 桥接目录是按哪个版本生成的(SKILL.md 标题行)
|
|
214
|
-
Select-String -Path (Join-Path $env:DSH_PROFILE_DIR 'node_modules\dsh-unity-mcp-bridge\skills\SKILL.md') `
|
|
214
|
+
Select-String -Path (Join-Path $env:DSH_PROFILE_DIR 'node_modules\dsh-unity-mcp-bridge\skills\unity-mcp-tools\SKILL.md') `
|
|
215
215
|
-Pattern 'com\.ivanmurzak\.unity\.mcp@'
|
|
216
216
|
# 与项目里的包版本不一致 → 重生成,然后重启 dsh web(技能在插件启动时注册,不重启不生效)
|
|
217
217
|
powershell -NoProfile -ExecutionPolicy Bypass -File "<dsh-unity-mcp-bridge>\tools\generate-unity-mcp-catalog.ps1" -ProjectRoot $proj
|
|
@@ -1,54 +1,59 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: unity-mcp-tools
|
|
3
|
-
description: Unity-MCP 命令索引(分类 + 命令名),含「激活 → 按需开启 → 用完恢复休眠」工作流。需要某命令的用途或参数时,读 reference/<分类>.md。
|
|
4
|
-
whenToUse: 由用户以 /unity-mcp-tools 调用:Unity 能力默认完全关闭,调用本技能后先激活,再按索引定位并开启所需命令,任务结束必须恢复休眠。
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Unity-MCP 命令索引
|
|
8
|
-
|
|
9
|
-
包 `com.ivanmurzak.unity.mcp@1.
|
|
10
|
-
|
|
11
|
-
调用名 `mcp__unity__<命令名>`。**本文件只是知识,不产生能力**:Unity 侧未启用的命令无法调用(服务未运行则全部无法调用)。
|
|
12
|
-
|
|
13
|
-
## 工作流程(必须遵守)
|
|
14
|
-
|
|
15
|
-
**Unity 能力默认完全关闭**:插件处于休眠状态,不连接 Unity、不注册任何 `mcp__unity__*` 工具。本技能是唯一的开启入口,由用户显式调用。
|
|
16
|
-
|
|
17
|
-
0. **激活** —— 先调用 `unity_mcp_activate`,建立连接并注册 Unity 工具(本技能被调用后的第一步)。
|
|
18
|
-
1. **定位** —— 在本索引找到需要的能力,读对应的 `reference/<分类>.md`,拿到命令名与参数名。
|
|
19
|
-
- 索引之外的命令名(例如装了扩展包后新增的)先调 `mcp__unity__unity-tool-list` 核对,不要凭记忆猜。
|
|
20
|
-
2. **开启** —— 调用 `mcp__unity__tool-set-enabled-state
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
---
|
|
2
|
+
name: unity-mcp-tools
|
|
3
|
+
description: Unity-MCP 命令索引(分类 + 命令名),含「激活 → 按需开启 → 用完恢复休眠」工作流。需要某命令的用途或参数时,读 reference/<分类>.md;可选扩展清单见 reference/extensions.md。
|
|
4
|
+
whenToUse: 由用户以 /unity-mcp-tools 调用:Unity 能力默认完全关闭,调用本技能后先激活,再按索引定位并开启所需命令,任务结束必须恢复休眠。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Unity-MCP 命令索引
|
|
8
|
+
|
|
9
|
+
包 `com.ivanmurzak.unity.mcp@1.6.0` | 命令 19 个(默认启用 7)| 生成 2026-11-01
|
|
10
|
+
|
|
11
|
+
调用名 `mcp__unity__<命令名>`。**本文件只是知识,不产生能力**:Unity 侧未启用的命令无法调用(服务未运行则全部无法调用)。
|
|
12
|
+
|
|
13
|
+
## 工作流程(必须遵守)
|
|
14
|
+
|
|
15
|
+
**Unity 能力默认完全关闭**:插件处于休眠状态,不连接 Unity、不注册任何 `mcp__unity__*` 工具。本技能是唯一的开启入口,由用户显式调用。
|
|
16
|
+
|
|
17
|
+
0. **激活** —— 先调用 `unity_mcp_activate`,建立连接并注册 Unity 工具(本技能被调用后的第一步)。
|
|
18
|
+
1. **定位** —— 在本索引找到需要的能力,读对应的 `reference/<分类>.md`,拿到命令名与参数名。
|
|
19
|
+
- 索引之外的命令名(例如装了扩展包后新增的)先调 `mcp__unity__unity-tool-list` 核对,不要凭记忆猜。
|
|
20
|
+
2. **开启** —— 调用 `mcp__unity__tool-set-enabled-state`(桥接保留的最小开关;1.6.0 起正式名 `tool-set-visibility`,两者等价),把需要的命令设为 `enabled: true`(或 `visible: true`;可一次传多个)。
|
|
21
|
+
- 1.6.0 起的“可见性”只决定工具是否出现在 `tools/list`(= 是否进入模型上下文);隐藏的工具仍可按名调用,但不在索引可见列表里。
|
|
22
|
+
- 开启后**下一个步骤**才生效:工具注册表在请求边界重建,**不能在同一个步骤里开启并调用**。
|
|
23
|
+
3. **使用** —— 下一步直接调用 `mcp__unity__<命令名>`。
|
|
24
|
+
- 读写 Unity 内容优先走 RQL:`rql-schema` 认类型 → `rql-query` 读 → `rql-mutate` 写(`dry_run: true` 先预览;改动在编辑器里 Ctrl+Z 可撤销,全有或全无)。
|
|
25
|
+
4. **恢复(必做,任务结束时)** —— 调用 `unity_tools_restore`:隐藏除 `tool-set-enabled-state` 以外的全部已开启命令,并断开连接、注销全部 `mcp__unity__*` 工具,回到休眠状态。
|
|
26
|
+
- 想保留个别命令:`unity_tools_restore({ "keep": ["rql-query"] })`(仍会断开休眠)。
|
|
27
|
+
|
|
28
|
+
为什么必须恢复:**每个处于可见状态的命令,其完整 JSON Schema 都会进入之后每一次模型请求**(隐藏的不会)。开启是临时的、可回收的成本;忘记关闭就等于把这个成本永久留在上下文里。
|
|
29
|
+
|
|
30
|
+
## 版本适配(读索引前先确认)
|
|
31
|
+
|
|
32
|
+
- 本索引由插件源码生成,**命令名随包版本变**;标题行的包版本就是本索引的依据。换版本后重新生成,不要沿用旧索引。
|
|
33
|
+
- **1.2.0 起**:`gameobject-*`、`assets-*`、`scene-*`、`profiler-*`、`console-*`、`editor-application-*`、`editor-selection-*`、`object-*`、`reflection-method-*`、`type-get-json-schema` 已从插件中移除,改由 `rql-query` / `rql-mutate` / `rql-schema` 承担(见 `reference/rql.md`)。按旧名字调用必然失败。
|
|
34
|
+
- **1.6.0 起**:`tool-set-enabled-state` 更名为 `tool-set-visibility`(旧名保留,等价;`Enabled` 字段即 `Visible`);“启用/关闭”实际是**可见性**——只影响 `tools/list` 是否列出(即是否进入模型上下文),隐藏的工具仍可按名调用。默认只有少数核心工具可见,**管理开关本身也默认隐藏**,所以要先用 CLI 把它设为 visible,桥接激活后模型才拿得到开关。
|
|
35
|
+
- 扩展包(10 个:Animation / Cinemachine / InputSystem / Navigation / ParticleSystem / ProBuilder / Splines / Terrain / Tilemap / Timeline)都是独立 UPM 包,装到工程后才新增命令;**本索引不含扩展命令** —— 可选哪些扩展、各带哪些命令见 `reference/extensions.md`,装完用 `unity-tool-list` 取实时清单。
|
|
36
|
+
- 插件的 `toolFormat`(`Rql` | `Json`,1.2.0 默认 `Rql`)决定工具参数与结果的数据表示;写参数前看 `reference/<分类>.md` 的参数说明。
|
|
37
|
+
|
|
38
|
+
## Package Manager (4) → `reference/package-manager.md`
|
|
39
|
+
package-add, package-list, package-remove, package-search
|
|
40
|
+
|
|
41
|
+
## RQL (3) → `reference/rql.md`
|
|
42
|
+
rql-mutate, rql-query, rql-schema
|
|
43
|
+
|
|
44
|
+
## Screenshot (4) → `reference/screenshot.md`
|
|
45
|
+
screenshot-camera, screenshot-game-view, screenshot-isolated, screenshot-scene-view
|
|
46
|
+
|
|
47
|
+
## Script (4) → `reference/script.md`
|
|
48
|
+
script-delete, script-execute, script-read, script-update-or-create
|
|
49
|
+
|
|
50
|
+
## Tests (1) → `reference/tests.md`
|
|
51
|
+
tests-run
|
|
52
|
+
|
|
53
|
+
## Tool (3) → `reference/tool.md`
|
|
54
|
+
tool-set-enabled-state, tool-set-visibility, unity-tool-list
|
|
55
|
+
|
|
56
|
+
## Extensions (10) → `reference/extensions.md`
|
|
57
|
+
Animation, Cinemachine, InputSystem, Navigation, ParticleSystem, ProBuilder, Splines, Terrain, Tilemap, Timeline
|
|
58
|
+
|
|
59
|
+
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Extensions — 10 个可选扩展
|
|
2
|
+
|
|
3
|
+
来源:插件包 `com.ivanmurzak.unity.mcp@1.6.0` 内的 `extensions.catalog.json`(生成 2026-11-01)。
|
|
4
|
+
|
|
5
|
+
这些是**可选扩展**,每个都是独立 UPM 包;装进 Unity 工程后才会新增命令,**且不会出现在本索引其余分类里**:
|
|
6
|
+
|
|
7
|
+
- 安装:Unity 的 AI Game Developer 窗口 → Extensions → Install;或 `unity-mcp-cli install-extension <名称> <Unity工程>`。
|
|
8
|
+
- 装完用 `mcp__unity__unity-tool-list`(可带 `regexSearch` / `includeInputs`)取实时清单,再用 `mcp__unity__tool-set-enabled-state` 按需开启。
|
|
9
|
+
- 扩展工具随扩展版本变,本文件只保证「依据哪个插件版本的 catalog 生成」;换离线包后由 `/unity-mcp-update-tools` 重生成。
|
|
10
|
+
|
|
11
|
+
## Animation — `com.ivanmurzak.unity.mcp.animation`
|
|
12
|
+
|
|
13
|
+
AI-driven animation control and playback tools.
|
|
14
|
+
|
|
15
|
+
- `animation-create` — Create AnimationClip assets with keyframes
|
|
16
|
+
- `animation-get-data` — Inspect clip curves, events, and properties
|
|
17
|
+
- `animation-modify` — Edit curves, events, and settings on a clip
|
|
18
|
+
- `animator-create` — Create AnimatorController assets
|
|
19
|
+
- `animator-get-data` — Inspect controller layers, states, and parameters
|
|
20
|
+
- `animator-modify` — Edit parameters, states, and transitions
|
|
21
|
+
|
|
22
|
+
## Cinemachine — `com.ivanmurzak.unity.mcp.cinemachine`
|
|
23
|
+
|
|
24
|
+
AI-assisted Cinemachine camera setup and configuration tools.
|
|
25
|
+
|
|
26
|
+
- `cinemachine-camera-create` — Create a CinemachineCamera in the scene
|
|
27
|
+
- `cinemachine-set-targets` — Set the Follow and LookAt targets
|
|
28
|
+
- `cinemachine-set-lens` — Configure FOV, clip planes, and dutch
|
|
29
|
+
- `cinemachine-set-body` — Set the position-control component (Follow/Orbital/...)
|
|
30
|
+
- `cinemachine-set-noise` — Add camera shake via Perlin noise
|
|
31
|
+
|
|
32
|
+
## InputSystem — `com.ivanmurzak.unity.mcp.inputsystem`
|
|
33
|
+
|
|
34
|
+
AI-assisted Unity Input System authoring: InputActionAssets, maps, actions, bindings, and control schemes.
|
|
35
|
+
|
|
36
|
+
- `inputsystem-asset-create` — Create a new .inputactions InputActionAsset
|
|
37
|
+
- `inputsystem-actionmap-add` — Add an ActionMap to the asset
|
|
38
|
+
- `inputsystem-action-add` — Add an Action (type + expectedControlType)
|
|
39
|
+
- `inputsystem-binding-add` — Add a binding path to an Action
|
|
40
|
+
- `inputsystem-binding-composite-add` — Add a composite binding (2DVector/1DAxis)
|
|
41
|
+
- `inputsystem-controlscheme-add` — Add a control scheme with device requirements
|
|
42
|
+
- `inputsystem-get` — Read the asset's maps, actions, and bindings
|
|
43
|
+
|
|
44
|
+
## Navigation — `com.ivanmurzak.unity.mcp.navigation`
|
|
45
|
+
|
|
46
|
+
AI-driven NavMesh navigation: surfaces, baking, agents, and links.
|
|
47
|
+
|
|
48
|
+
- `navigation-surface-add` — Add and configure a NavMeshSurface
|
|
49
|
+
- `navigation-set-bake-settings` — Set agent radius/height/slope/step and voxel size
|
|
50
|
+
- `navigation-surface-bake` — Bake or clear a NavMeshSurface
|
|
51
|
+
- `navigation-modifier-add` — Add a NavMeshModifier (override area / ignore)
|
|
52
|
+
- `navigation-modifier-volume-add` — Add a NavMeshModifierVolume
|
|
53
|
+
- `navigation-link-add` — Add a NavMeshLink between two points
|
|
54
|
+
- `navigation-agent-add` — Add and configure a NavMeshAgent
|
|
55
|
+
- `navigation-agent-set-destination` — Set a NavMeshAgent's destination
|
|
56
|
+
- `navigation-list` — List NavMeshSurfaces and NavMeshAgents
|
|
57
|
+
- `navigation-get` — Serialize any NavMesh component
|
|
58
|
+
- `navigation-modify` — Modify any NavMesh component via ReflectorNet
|
|
59
|
+
|
|
60
|
+
## ParticleSystem — `com.ivanmurzak.unity.mcp.particlesystem`
|
|
61
|
+
|
|
62
|
+
AI-powered particle system creation and control tools.
|
|
63
|
+
|
|
64
|
+
- `particle-system-get` — Inspect ParticleSystem modules and settings
|
|
65
|
+
- `particle-system-modify` — Modify emission, shape, color, noise, and more
|
|
66
|
+
|
|
67
|
+
## ProBuilder — `com.ivanmurzak.unity.mcp.probuilder`
|
|
68
|
+
|
|
69
|
+
AI-assisted ProBuilder geometry modeling tools.
|
|
70
|
+
|
|
71
|
+
- `probuilder-create-shape` — Create editable 3D primitives in the scene
|
|
72
|
+
- `probuilder-get-mesh-info` — Retrieve faces, vertices, and edges data
|
|
73
|
+
- `probuilder-extrude` — Extrude faces along their normals
|
|
74
|
+
- `probuilder-delete-faces` — Remove faces to create holes or trim geometry
|
|
75
|
+
- `probuilder-set-face-material` — Assign materials to individual faces
|
|
76
|
+
|
|
77
|
+
## Splines — `com.ivanmurzak.unity.mcp.splines`
|
|
78
|
+
|
|
79
|
+
AI-assisted Spline authoring: containers, knots, tangents, and evaluation.
|
|
80
|
+
|
|
81
|
+
- `splines-container-create` — Create a SplineContainer in the scene
|
|
82
|
+
- `splines-add-knot` — Append a knot to a spline
|
|
83
|
+
- `splines-set-knot` — Set a knot's position, tangents, and rotation
|
|
84
|
+
- `splines-set-tangent-mode` — Set a knot's tangent mode
|
|
85
|
+
- `splines-evaluate` — Evaluate position/tangent/up along a spline
|
|
86
|
+
- `splines-modify` — Modify any Splines component via ReflectorNet
|
|
87
|
+
|
|
88
|
+
## Terrain — `com.ivanmurzak.unity.mcp.terrain`
|
|
89
|
+
|
|
90
|
+
AI-powered Unity Terrain authoring tools.
|
|
91
|
+
|
|
92
|
+
- `terrain-create` — Create a Terrain GameObject backed by new TerrainData
|
|
93
|
+
- `terrain-set-heights` — Sculpt heightmap values over a region or the whole terrain
|
|
94
|
+
- `terrain-paint-layer` — Paint a TerrainLayer onto the alphamap (splatmap)
|
|
95
|
+
- `terrain-place-trees` — Scatter or place trees from a tree prototype
|
|
96
|
+
- `terrain-set-neighbors` — Stitch neighbor Terrains so Unity blends seams
|
|
97
|
+
|
|
98
|
+
## Tilemap — `com.ivanmurzak.unity.mcp.tilemap`
|
|
99
|
+
|
|
100
|
+
AI-assisted 2D Tilemap creation, painting, and tile/RuleTile asset tools.
|
|
101
|
+
|
|
102
|
+
- `tilemap-create` — Create a Grid + Tilemap + TilemapRenderer
|
|
103
|
+
- `tilemap-set-tile` — Paint a tile into a cell
|
|
104
|
+
- `tilemap-box-fill` — Fill a rectangular region with a tile
|
|
105
|
+
- `tilemap-create-tile-asset` — Create a Tile asset from a Sprite
|
|
106
|
+
- `tilemap-create-rule-tile` — Create a RuleTile asset (2D Tilemap Extras)
|
|
107
|
+
|
|
108
|
+
## Timeline — `com.ivanmurzak.unity.mcp.timeline`
|
|
109
|
+
|
|
110
|
+
AI-assisted Timeline cutscene and sequence authoring tools.
|
|
111
|
+
|
|
112
|
+
- `timeline-create` — Create a TimelineAsset (.playable)
|
|
113
|
+
- `timeline-track-add` — Add Animation/Activation/Audio/Signal/Control tracks
|
|
114
|
+
- `timeline-clip-add` — Add clips to a track with start and duration
|
|
115
|
+
- `timeline-director-bind` — Bind a TimelineAsset to a scene PlayableDirector
|
|
116
|
+
- `timeline-modify` — Modify any Timeline object via ReflectorNet
|
|
117
|
+
|
|
118
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Package Manager — 4 个命令
|
|
2
2
|
|
|
3
|
-
调用名 `mcp__unity__<命令名>`;`[on]` = Unity
|
|
3
|
+
调用名 `mcp__unity__<命令名>`;`[on]` = Unity 侧默认可见(可直接调),`[off]` = 默认隐藏 —— 用 `mcp__unity__tool-set-enabled-state`(1.6.0 正式名 `tool-set-visibility`,等价)设为 visible 后,**从下一个步骤起可调用**(工具注册表在请求边界重建)。
|
|
4
4
|
|
|
5
5
|
- `package-add` [off] — Install a package from the Unity Package Manager registry, Git URL, or local path.
|
|
6
6
|
- 参数: packageId, requestId?
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# RQL — 3 个命令
|
|
2
|
+
|
|
3
|
+
调用名 `mcp__unity__<命令名>`;`[on]` = Unity 侧默认可见(可直接调),`[off]` = 默认隐藏 —— 用 `mcp__unity__tool-set-enabled-state`(1.6.0 正式名 `tool-set-visibility`,等价)设为 visible 后,**从下一个步骤起可调用**(工具注册表在请求边界重建)。
|
|
4
|
+
|
|
5
|
+
- `rql-mutate` [on] — Change the live Unity Editor scene with an RQL query whose last stage is set or call.
|
|
6
|
+
- 参数: query, dry_run?, max_targets?
|
|
7
|
+
- 源码: `Editor/Scripts/API/Tool/Rql.Mutate.cs`
|
|
8
|
+
- `rql-query` [on] — Run a read-only RQL query against the live Unity Editor scene and return compact rows.
|
|
9
|
+
- 参数: query
|
|
10
|
+
- 源码: `Editor/Scripts/API/Tool/Rql.Query.cs`
|
|
11
|
+
- `rql-schema` [on] — Without a type: RQL sources, asset functions, the installed extensions (always active) with their guide topics, and the component types p...
|
|
12
|
+
- 参数: type?
|
|
13
|
+
- 源码: `Editor/Scripts/API/Tool/Rql.Schema.cs`
|
|
14
|
+
|
|
15
|
+
### `rql-mutate` 的完整用法(插件喂给模型的原文,已按段落去重)
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
Change the live Unity Editor scene with an RQL query whose last stage is set or call. All-or-nothing: every target and value is checked before anything is written; a failure changes nothing. Undoable: one Undo step per call (Ctrl+Z; from an agent: script-execute UnityEditor.Undo.PerformUndo(), then editor | call SaveScenes() and editor | call SaveAssets()). Changed assets, scenes and the open prefab are saved to disk automatically; an untitled scene needs SaveAs(path). dry_run=true returns the receipt ($ref, member, old, new) without changing anything. Do exactly the change requested; a read-only member fails with readonly-member instead of being approximated.
|
|
19
|
+
set path = expr, ... assign members (paths may go through structs: set transform.position.y = transform.position.y + 1)
|
|
20
|
+
values see each target: $ and $index (its position in the stream entering set / call)
|
|
21
|
+
call Method(args) invoke a method the tools expose
|
|
22
|
+
Examples:
|
|
23
|
+
objects | where name == "Player" | set transform.position = "(0, 1, 0)"
|
|
24
|
+
objects | get components | where $ is Light | set intensity = intensity * 2, color = "#ffcc88"
|
|
25
|
+
objects | where tag == "Enemy" | set active = false
|
|
26
|
+
objects | where name starts-with "Pillar_" | set name = name.replace("Pillar_", "Column_") bulk rename
|
|
27
|
+
objects | where name starts-with "Crate" | sort name | set transform.position.x = $index * 2 spread along x
|
|
28
|
+
objects | where name starts-with "Coin" | set transform.localScale = transform.localScale * 1.5 vectors / colors compute per component (a color's alpha too)
|
|
29
|
+
objects | where name starts-with "Lamp" | set transform.position = transform.position + [0, 2.5, 0]
|
|
30
|
+
objects | where name starts-with "Rock" | set transform.position = [transform.position.x, 0, transform.position.z] * 2 lists of numbers are vectors
|
|
31
|
+
objects | where name starts-with "Enemy" and distance(transform.position, unity.find("Player").transform.position) < 10 | set active = false (units: meters)
|
|
32
|
+
objects | where name == "Drone" | set transform.position = transform.position + normalize(transform.forward) * 3 also length(v), dot(a, b), lerp(a, b, t)
|
|
33
|
+
unity.asset("Assets/Mats/Red.mat") | get properties | where Key ends-with "Color" | set Value = "#ffffff" map entries write through
|
|
34
|
+
unity.asset("Assets/Mats/Red.mat") | set properties["_Color"] = "(1, 0, 0, 1)"
|
|
35
|
+
unity.asset("Assets/Mats/Red.mat") | set parent = unity.asset("Assets/Mats/Base.mat") make it a Material Variant of Base
|
|
36
|
+
unity.asset("Assets/Data/Items.asset") | get rows | where Category == "Tool" | set Price = round(Price * 1.15) data asset (ScriptableObject list rows)
|
|
37
|
+
objects | where name starts-with "Pillar" | get components | where $ is MeshFilter | set sharedMesh = "Cylinder" built-in mesh
|
|
38
|
+
objects | get components | where $ is MeshRenderer and sharedMaterial == null | set sharedMaterial = "Default-Material" built-in material
|
|
39
|
+
objects | where name == "Crate" | get components | where $ is MeshRenderer | set sharedMaterial = {$type: "Material", color: "#ff8800"} a new material (saved with the scene)
|
|
40
|
+
objects | where name == "Shop" | get components | where $ is ShopStock | set item = {$type: "ItemData", price: 3} a new data ScriptableObject
|
|
41
|
+
unity.asset("Assets/Art/hero.png") | get importer | set textureType = "Sprite", spriteImportMode = "Single" import settings (reimported)
|
|
42
|
+
objects | where name == "Spawner" | set targets = append(targets, ref("GameObject#1234"))
|
|
43
|
+
Create / add / remove (call; the receipt's result column holds the new object's $ref for follow-up queries):
|
|
44
|
+
editor | call CreateGameObject("Props") new root GameObject
|
|
45
|
+
editor | call CreateGameObject("Crate", ref("GameObject#1234"), "Cube") child of a parent, optional primitive
|
|
46
|
+
range(0, 300) | call editor.CreateGameObject("Cube_" + $, {primitive: "Cube", position: [($ % 15) * 2, 0, floor($ / 15) * 2]}) with max_targets=300:
|
|
47
|
+
bulk create, one call per item: a 15x20 grid in ONE request and ONE Undo step; the receipt lists the first 50 new objects' $refs (query the rest by name)
|
|
48
|
+
[["Crate", [0, 0, 0]], ["Barrel", [2, 0, 0]]] | call editor.CreateGameObject($[0], {primitive: "Cube", position: $[1]}) one per entry
|
|
49
|
+
{placement}: primitive, parent: ref(…), position / rotation (Euler degrees) / scale as [x, y, z], local to the parent
|
|
50
|
+
editor | call CreateGameObject({name: "Crate", primitive: "Cube", position: [1, 0, 2], scale: [2, 2, 2]}) arguments by name: one literal, any order, the rest default
|
|
51
|
+
objects | where name == "Crate" | call AddComponent("Rigidbody") add a component by type name
|
|
52
|
+
objects | where name == "Old" | call Destroy() remove a GameObject (components: get components | where $ is X | call Destroy())
|
|
53
|
+
objects | where name == "Lamp" | set transform.parent = ref("GameObject#1234") reparent (keeps the world position)
|
|
54
|
+
objects | where name == "Crate" | call Duplicate() copy next to it (returns the copy)
|
|
55
|
+
objects | where name == "Main Camera" | call LookAt(unity.find("Player")) aim at a GameObject (or a position "(0, 1, 0)")
|
|
56
|
+
Scenes, prefabs, assets, Editor state:
|
|
57
|
+
editor | call OpenScene("Assets/Scenes/Level.unity") editor | call NewScene("Assets/Scenes/New.unity")
|
|
58
|
+
scenes | where path == "" | call SaveAs("Assets/Scenes/New.unity") scenes | where name == "Level" | call SetActive()
|
|
59
|
+
editor | call InstantiatePrefab("Assets/Prefabs/Enemy.prefab", {parent: ref("GameObject#1234"), position: [0, 0, 5]})
|
|
60
|
+
range(0, 10) | call editor.InstantiatePrefab("Assets/Prefabs/Coin.prefab", {position: [$ * 2, 1, 0]}) ten instances, one Undo step
|
|
61
|
+
objects | where name == "Crate" | call SaveAsPrefab("Assets/Prefabs/Crate.prefab") (on a prefab instance: a Prefab Variant)
|
|
62
|
+
objects | where name == "Coin_3" | call RevertPrefabOverrides() or ApplyPrefabOverrides() (read: select prefabSource prefabOverrides)
|
|
63
|
+
editor | call OpenPrefab("Assets/Prefabs/Enemy.prefab") then prefab | recurse children | … then editor | call ClosePrefab()
|
|
64
|
+
editor | call CreateMaterial("Assets/Mats/Glow.mat") editor | call MoveAsset("Assets/A.mat", "Assets/Mats/A.mat")
|
|
65
|
+
editor | call RefreshAssets() after files changed on disk: imports them, reloads a changed open scene (keeps one with unsaved edits and says so)
|
|
66
|
+
editor | set selection = [ref("GameObject#1234")] editor | set isPlaying = true (scripts reload: retry a call that fails right after)
|
|
67
|
+
editor | call AddLayer("Pickups") then objects | where name starts-with "Pickup" | set layerName = "Pickups" (read: editor | select layers tags)
|
|
68
|
+
editor | call AddTag("Interactive") then objects | where name starts-with "Barrel" | set tag = "Interactive"
|
|
69
|
+
profiler | call Start() profiler | call Save("Logs/profile.json") (read: profiler | select memory frame)
|
|
70
|
+
settings | set physics.gravity = "(0, -12, 0)", time.fixedDeltaTime = 0.01 Project Settings (saved, undoable)
|
|
71
|
+
settings | set build.scenes = append(build.scenes, "Assets/Scenes/Level2.unity") scenes in the build
|
|
72
|
+
Object literals build values: set settings = {speed: 2, $type: "FastSettings"}, and so do Materials and data ScriptableObjects (into a scene object; an asset or the open prefab cannot hold a new one: create the asset and pass its path). GameObjects, components and other assets are never built from a literal: pass unity.find("Name"), ref("Type#id") or an asset path. At most 200 targets (or bulk-create items) per call; max_targets raises the limit (up to 1000) for an intended bulk change. The receipt lists the assignments that change a value; "N unchanged" counts the ones whose target already held it (written anyway). A misspelt member that empties the stream of set / call fails with unknown-member (nothing changed); a real member that no matched item has is a no-op.
|
|
73
|
+
Agent rules: Deleting (DeleteAsset, Destroy, script-delete, or AssetDatabase / File deletes in script-execute) takes two turns unless the user named the exact items or you created them yourself in this task: first list the exact candidates (rql-query, a dry_run=true mutation or a read-only snippet), show them and end your turn; delete only that list, in a separate call, after the user confirms. Otherwise never find and delete candidates in the same turn. After project files change outside the Editor (written to disk by you, a script or the user), run editor | call RefreshAssets() before reading or changing them: it imports them and reloads an open scene whose file changed (changed .cs files recompile and the scripts reload: retry a call that fails right after). When you map a name the user misspelt to a real one (an object, component or member), say so. Unity units are meters, degrees (rotation) and seconds.
|
|
74
|
+
|
|
75
|
+
Query part: the RQL of rql-query (full guide and the sources in its description); unity.assets("t:Material"), unity.asset(path), unity.find("Name"), ref("Light#1234"). Stages: where, select, sort, first N, get <path>, recurse children. Operators: == != < > and or not, contains, starts-with, $ is Light. Paths a.b.c, list[0], map["key"]. Vectors/colors as "(1, 2, 3)" or "#ff8800"; enums as strings.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### `rql-query` 的完整用法(插件喂给模型的原文,已按段落去重)
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
Run a read-only RQL query against the live Unity Editor scene and return compact rows. One precise query beats many exploratory calls. Changes need rql-mutate.
|
|
82
|
+
|
|
83
|
+
RQL: source | stage | stage ...
|
|
84
|
+
Sources: objects (every GameObject in the loaded scenes, inactive included), roots, scenes, selection, prefab (the prefab open in prefab editing mode), console (Editor log entries), shaders, componentTypes, profiler (memory / rendering / frame snapshots; call Start / Stop / Save), tests (test methods; run a selection with tests-run query), testResults (last run), editor (Editor state and operations), settings (Project Settings: physics, time, quality, player, build). Assets: unity.assets("t:Material") or unity.assets("t:Prefab", "Assets/Enemies"), unity.asset("Assets/Mats/Red.mat"). ref("Light#1234") resolves a $ref; unity.find("Player") or unity.find("Level/Pillar_1") a GameObject by unique name or path.
|
|
85
|
+
Stages:
|
|
86
|
+
where <condition> filter (a boolean: where sharedMaterial != null, not where sharedMaterial)
|
|
87
|
+
select a b.c alias=(expr) project columns (wrap computed expressions in parentheses)
|
|
88
|
+
sort <expr> [desc], ... stable sort (computed keys in parentheses: sort (a * b) desc)
|
|
89
|
+
first N | skip N | count
|
|
90
|
+
get <path> replace each item by a member (lists are flattened)
|
|
91
|
+
recurse children [max-depth=N] [include-self=false] walk the hierarchy (input items included by default)
|
|
92
|
+
distinct [expr] | sum expr | min expr | max expr | avg expr (distinct keeps whole items; values: get tag | distinct)
|
|
93
|
+
group-by expr rows key|count; group-by a, b (or kind=$type) gives one column per key, then count;
|
|
94
|
+
items = the group's items: … | where $ is Light | group-by type | select key count avg=(items.avg(intensity))
|
|
95
|
+
Expressions: == != < <= > >= and or not + - * / %; contains, starts-with, ends-with (case-insensitive); matches "regex"; x in [a, b]; x is null; x is not null; $ is Light (includes subclasses); has(member); c ? a : b or if(c, a, b) (only the taken branch runs; where a stage takes one expression, wrap it: select kind=($ is Light ? "light" : "other")). Literals: numbers, "strings", true/false/null, lists [a, b], objects {x: 1, y: 2}. Text functions: lower upper len, replace(s, from, to) (case-insensitive), replace-regex(s, pattern, repl) ($1 = group 1), substring(s, start[, length]), split(s, sep), trim(s), pad(v, width[, fill]) — also as methods: name.replace("Old", "New"), name.substring(0, 4).
|
|
96
|
+
Paths: a.b.c, list[0], map["key"]; .member on a list maps over its elements. List methods: .any(pred) .all(pred) .count([pred]) .sum(e) .avg(e) .min(e) .max(e) .first([pred]); inside them bare names refer to the element, falling back to the outer item.
|
|
97
|
+
Meta: $ (current item), $ref (stable id such as Light#1234), $type, $path (the item's place in this query, e.g. roots[0].children[2]), $index, $depth. Enums compare to strings (type == "Spot", or the Inspector's name: shadowCastingMode == "Two Sided"); == on strings is case-sensitive.
|
|
98
|
+
Unity: GameObject has components (list), children (list), active, name, path (hierarchy path "Level/Props/Crate"), tag, layer, layerName, transform (position, localPosition, eulerAngles, localScale, parent; call LookAt(target) turns it toward a GameObject or a position). Component members are the C# members (public + [SerializeField]); find them via objects | get components | where $ is Light. Vectors/colors print as (x, y, z); write "(1, 2, 3)", [1, 2, 3] or {x: 1, y: 2, z: 3}; colors also "#ff8800". An asset's file: assetPath; its import settings: get importer. Material shader properties: properties["_Color"] (the main color / texture: color, mainTexture); a Material Variant has a parent. A Mesh value also takes a primitive's name ("Cylinder"), a Material value a built-in material's ("Default-Material"). Prefab instances: prefabSource, prefabOverrides (all of the instance's on its root, an object's own on a part). Destroyed objects read as null; a GameObject's missingReferences lists references to deleted assets or objects (where missingReferences.count() > 0). Navigate with paths or get; select only projects output columns.
|
|
99
|
+
Results come back as compact rows (header line, then col|col). Long results are truncated — refine with where/first or use count. Unknown members produce warnings with suggestions; rql-schema(type) lists a type's members.
|
|
100
|
+
Language rules:
|
|
101
|
+
- Conditions are booleans. where, and / or / not, ?: and the predicates of .any() .all() .count() .first() take a comparison or has(), never a bare value: where material != null (or has(material)), where count > 0, where name != "", where len(tags) > 0. A number, string, object or list there fails with type-mismatch; null counts as false.
|
|
102
|
+
- cond ? a : b (the same as if(cond, a, b)) picks a value and evaluates only the taken branch: set y = (y < 0 ? 0 : y). Inside select, wrap computed values in parentheses: select kind = (intensity > 2 ? "bright" : "dim").
|
|
103
|
+
- Lists compare by value, in order: tags == ["a", "b"], x in [[1, 2], [3, 4]]; distinct and group-by merge equal lists.
|
|
104
|
+
- group-by gives rows with key (or one column per key), count and the group's items: group-by kind | select key, count, avg = items.avg(weight); also items.sum(e), items.min(e), items.max(e), items.count(pred), items.first().name. Group by the item's type with $type (group-by $type); a bare type is a member that most items do not have.
|
|
105
|
+
- Receipts list only real changes: a set row whose value stayed the same is left out and counted as unchanged, so no rows with N unchanged means the values already matched.
|
|
106
|
+
- call Method(args) runs the method of each item (the items must be objects). call source.Method(args) runs the method of that one source object once per stream item, with $, $index, $path and $depth in the arguments being the item's; every call counts against the target limit, and every argument is checked before the first call (a dry run checks without calling).
|
|
107
|
+
- Bulk create: range(start, end[, step]) streams numbers (end excluded), and a list literal streams its elements, so one call creates many objects: range(0, 150) | call editor.CreateGameObject("Cube_" + $, {primitive: "Cube", position: [($ % 15) * 2, 0, floor($ / 15) * 2]}) builds a 15-wide grid, [["Crate", [0, 0, 0]], ["Barrel", [2, 0, 0]]] | call editor.CreateGameObject($[0], {primitive: "Cube", position: $[1]}) one object per entry. The receipt has one row per call with the $ref of the created object.
|
|
108
|
+
- Vectors and colors the host marks as component-wise compute component by component: set Scale = Scale * 1.5, Position + [0, 1, 0], Position - Offset, -Velocity, v / 2. Adding a number to a vector is a type-mismatch (add [x, y, z] instead); quaternions and other types without that mark stay type-mismatch. Lists of numbers are vectors too: [x, 0, z] * k, [1, 2] + [3, 4]. Vector functions work on both: length(v) (or v.length(), magnitude), normalize(v), distance(a, b), dot(a, b), lerp(a, b, t); len(x) stays the size of a string or list.
|
|
109
|
+
- Trigonometry is in radians: sin, cos, tan, asin, acos, atan, atan2(y, x), pi(), deg(x), rad(x); trigonometric results are rounded (sin(pi()) is 0). In a set value or call argument $count is the number of items entering the stage ($index runs 0 to $count - 1), so set position = [5 * cos(2 * pi() * $index / $count), 0, 5 * sin(2 * pi() * $index / $count)] lays the items out on a circle of radius 5.
|
|
110
|
+
- A missing map entry reads as null: props["k"] == null and props["k"] is null are true without the entry, and has(props["k"]) tests whether it exists. A misspelt member is not null: it stays unknown and is reported.
|
|
111
|
+
- Arguments by name: call Method({name: value, ...}) with one object literal that no overload takes as a whole binds each key to the parameter of that name; parameters left out keep their defaults, and an unknown name fails listing the parameters: range(0, 10) | call editor.CreateGameObject({name: "Tile" + $, primitive: "Cube", position: [$ * 2, 0, 0]}). Engine objects (scene objects, nodes, actors) are never built from an object literal: pass an existing one, e.g. ref("Type#id"). Value-like assets and owned subobjects that the host marks are built from a typed literal: set mesh = {$type: "TypeName", size: 2}.
|
|
112
|
+
|
|
113
|
+
Examples:
|
|
114
|
+
objects | where name contains "Enemy" and active | select $ref name transform.position
|
|
115
|
+
objects | get components | where $ is Light and intensity > 2 | select gameObject.name intensity color
|
|
116
|
+
roots | recurse children | where components.count() == 1 | select $path name
|
|
117
|
+
unity.assets("t:Material") | select name shader.name properties["_Color"]
|
|
118
|
+
console | where logType == "Error" | sort sequence desc | first 5 | select message
|
|
119
|
+
scenes | select name path isDirty rootCount
|
|
120
|
+
componentTypes | where name contains "Collider" | select name
|
|
121
|
+
editor | select isPlaying isPaused selection
|
|
122
|
+
settings | select physics.gravity time.fixedDeltaTime quality.levels
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### `rql-schema` 的完整用法(插件喂给模型的原文,已按段落去重)
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
Without a type: RQL sources, asset functions, the installed extensions (always active) with their guide topics, and the component types present in the loaded scenes (with counts), plus GameObject and Transform members. "guide:<topic>" prints one of the listed guides. With a type name (e.g. "Light", "Enemy", "Vector3"): that type's members (name type; ro = read-only) and methods. Use it before querying an unfamiliar component.
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Screenshot — 4 个命令
|
|
2
2
|
|
|
3
|
-
调用名 `mcp__unity__<命令名>`;`[on]` = Unity
|
|
3
|
+
调用名 `mcp__unity__<命令名>`;`[on]` = Unity 侧默认可见(可直接调),`[off]` = 默认隐藏 —— 用 `mcp__unity__tool-set-enabled-state`(1.6.0 正式名 `tool-set-visibility`,等价)设为 visible 后,**从下一个步骤起可调用**(工具注册表在请求边界重建)。
|
|
4
4
|
|
|
5
5
|
- `screenshot-camera` [off] — Captures a screenshot from a camera and returns it as an image.
|
|
6
6
|
- 参数: cameraRef?, width?, height?
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Script — 4 个命令
|
|
2
2
|
|
|
3
|
-
调用名 `mcp__unity__<命令名>`;`[on]` = Unity
|
|
3
|
+
调用名 `mcp__unity__<命令名>`;`[on]` = Unity 侧默认可见(可直接调),`[off]` = 默认隐藏 —— 用 `mcp__unity__tool-set-enabled-state`(1.6.0 正式名 `tool-set-visibility`,等价)设为 visible 后,**从下一个步骤起可调用**(工具注册表在请求边界重建)。
|
|
4
4
|
|
|
5
5
|
- `script-delete` [off] — Delete the script file(s).
|
|
6
6
|
- 参数: files, requestId?
|
|
7
7
|
- 源码: `Editor/Scripts/API/Tool/Script.Delete.cs`
|
|
8
|
-
- `script-execute` [on] — Compiles and
|
|
9
|
-
- 参数: csharpCode, className?, methodName?, parameters?, isMethodBody?
|
|
8
|
+
- `script-execute` [on] — Compiles and runs C# in the Unity Editor: plain statements with the last expression as the result (own usings, local classes, await allow...
|
|
9
|
+
- 参数: csharpCode, className?, methodName?, parameters?, isMethodBody?, usings?, include?, timeout?
|
|
10
10
|
- 源码: `Editor/Scripts/API/Tool/Script.Execute.cs`
|
|
11
11
|
- `script-read` [off] — Reads the content of a script file and returns it as a string.
|
|
12
12
|
- 参数: filePath, lineFrom?, lineTo?
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# Tests — 1 个命令
|
|
2
|
-
|
|
3
|
-
调用名 `mcp__unity__<命令名>`;`[on]` = Unity
|
|
4
|
-
|
|
5
|
-
- `tests-run` [on] — Execute Unity tests and return detailed results.
|
|
6
|
-
- 参数: testMode?, testAssembly?, testNamespace?, testClass?, testMethod?, query?, result?, includePassingTests?, includeMessages?, includeStacktrace?, includeLogs?, logType?, includeLogsStacktrace?, requestId?
|
|
7
|
-
- 源码: `Editor/Scripts/API/Tool/Tests.Run.cs`
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
# Tests — 1 个命令
|
|
2
|
+
|
|
3
|
+
调用名 `mcp__unity__<命令名>`;`[on]` = Unity 侧默认可见(可直接调),`[off]` = 默认隐藏 —— 用 `mcp__unity__tool-set-enabled-state`(1.6.0 正式名 `tool-set-visibility`,等价)设为 visible 后,**从下一个步骤起可调用**(工具注册表在请求边界重建)。
|
|
4
|
+
|
|
5
|
+
- `tests-run` [on] — Execute Unity tests and return detailed results.
|
|
6
|
+
- 参数: testMode?, testAssembly?, testNamespace?, testClass?, testMethod?, query?, result?, includePassingTests?, includeMessages?, includeStacktrace?, includeLogs?, logType?, includeLogsStacktrace?, requestId?
|
|
7
|
+
- 源码: `Editor/Scripts/API/Tool/Tests.Run.cs`
|
|
8
|
+
|
|
9
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Tool — 3 个命令
|
|
2
|
+
|
|
3
|
+
调用名 `mcp__unity__<命令名>`;`[on]` = Unity 侧默认可见(可直接调),`[off]` = 默认隐藏 —— 用 `mcp__unity__tool-set-enabled-state`(1.6.0 正式名 `tool-set-visibility`,等价)设为 visible 后,**从下一个步骤起可调用**(工具注册表在请求边界重建)。
|
|
4
|
+
|
|
5
|
+
- `tool-set-enabled-state` [off] — DEPRECATED, use tool-set-visibility.
|
|
6
|
+
- 参数: tools, includeLogs?
|
|
7
|
+
- 源码: `Editor/Scripts/API/Tool/Tool.SetEnabledState.cs`
|
|
8
|
+
- `tool-set-visibility` [off] — Show or hide MCP tools by name.
|
|
9
|
+
- 参数: tools, includeLogs?
|
|
10
|
+
- 源码: `Editor/Scripts/API/Tool/Tool.SetVisibility.cs`
|
|
11
|
+
- `unity-tool-list` [on] — List all Unity-MCP tools registered in the connected Unity Editor instance, hidden ones included (each with Visible).
|
|
12
|
+
- 参数: regexSearch?, includeDescription?, includeInputs?
|
|
13
|
+
- 源码: `Editor/Scripts/API/Tool/Tool.List.cs`
|
|
14
|
+
|
|
15
|
+
|