You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/development/README-DEV.md
+101-1Lines changed: 101 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,41 @@
9
9
10
10
Before proposing major new features, please reach out to discuss - someone may already be working on it or it may have been considered previously. Open an issue or discussion to coordinate.
11
11
12
+
Keep PRs focused. A small fix with a clear repro and the exact Unity/package versions is much easier to review than a broad cleanup bundled with behavior changes.
13
+
14
+
For bug fixes, include:
15
+
16
+
- Unity version(s) tested
17
+
- package source used (`#beta`, `#main`, tag, fork branch, or `file:`)
18
+
- resolved Git commit from `Packages/packages-lock.json` when the package source is a Git URL
19
+
- commands/tests run locally
20
+
21
+
Avoid mixing release/version bumps with feature or bug-fix PRs. The release workflows handle package and server version updates.
-`CustomTools/` - examples and support code for project-defined custom tools.
31
+
12
32
## Local Development Setup
13
33
34
+
### 0. Prepare the Python Server
35
+
36
+
For server work, use the same setup path as CI:
37
+
38
+
```bash
39
+
cd Server
40
+
uv sync
41
+
uv pip install -e ".[dev]"
42
+
uv run pytest tests/ -v --tb=short
43
+
```
44
+
45
+
Most Python unit tests do not need Unity running. Integration tests that talk to the Editor require a Unity instance with the bridge connected.
46
+
14
47
### 1. Point Unity to Your Local Server
15
48
16
49
For the fastest iteration when working on the Python server:
@@ -36,9 +69,53 @@ Options:
36
69
37
70
After switching, open Package Manager in Unity and Refresh to re-resolve packages.
38
71
72
+
When testing Unity package changes, prefer **Local workspace**. Do not patch `Library/PackageCache/` directly; Unity may overwrite it on the next resolve.
73
+
74
+
`#beta` and `#main` are moving branch names. When debugging a package-source issue, check `Packages/packages-lock.json` as well as `Packages/manifest.json`; the lock file tells you the commit Unity actually resolved.
- a Python-facing tool under `Server/src/services/tools/`
92
+
93
+
Resources follow the same split:
94
+
95
+
- C# resources under `MCPForUnity/Editor/Resources/`
96
+
- Python resources under `Server/src/services/resources/`
97
+
98
+
Use `[McpForUnityTool]` / `[McpForUnityResource]` on the Unity side and `@mcp_for_unity_tool` / `@mcp_for_unity_resource` on the server side. If the tool is long-running, use the existing `PendingResponse` / polling patterns instead of blocking the bridge.
99
+
100
+
Current server tool groups are:
101
+
102
+
-`core`
103
+
-`docs`
104
+
-`vfx`
105
+
-`animation`
106
+
-`ui`
107
+
-`scripting_ext`
108
+
-`testing`
109
+
-`probuilder`
110
+
-`profiling`
111
+
112
+
Tools with `group=None` are server meta-tools and are always visible. The default enabled group is `core`; other groups can be enabled through the Tools tab or `manage_tools`.
113
+
114
+
When adding, removing, or renaming tools/resources, update the public docs and client metadata. Start with `tools/UPDATE_DOCS_PROMPT.md`, then review the changes manually.
115
+
39
116
## Tool Selection & the Meta-Tool
40
117
41
-
MCP for Unity organizes tools into **groups** (Core, VFX & Shaders, Animation, UI Toolkit, Scripting Extensions, Testing). You can selectively enable or disable tools to control which capabilities are exposed to AI clients — reducing context window usage and focusing the AI on relevant tools.
118
+
MCP for Unity organizes tools into **groups**. You can selectively enable or disable tools to control which capabilities are exposed to AI clients — reducing context window usage and focusing the AI on relevant tools.
42
119
43
120
### Using the Tools Tab in the Editor
44
121
@@ -99,10 +176,20 @@ cd Server
99
176
uv run pytest tests/ -v
100
177
```
101
178
179
+
Useful narrower runs:
180
+
181
+
```bash
182
+
uv run pytest tests/test_manage_camera.py -v
183
+
uv run pytest tests/integration/test_run_tests_async.py -v
184
+
uv run pytest tests/ -v --tb=short
185
+
```
186
+
102
187
### Unity C# Tests
103
188
104
189
Located in `TestProjects/UnityMCPTests/Assets/Tests/`.
105
190
191
+
The test project consumes the local Unity package from this repo. Use it for package import/compile checks before opening a PR that touches `MCPForUnity/Runtime/`, `MCPForUnity/Editor/`, or package metadata.
192
+
106
193
**Using the CLI** (requires Unity running with MCP bridge connected):
107
194
108
195
```bash
@@ -138,6 +225,19 @@ uv run pytest tests/ --cov --cov-report=html
138
225
open htmlcov/index.html
139
226
```
140
227
228
+
## Compatibility Notes
229
+
230
+
The Unity package currently declares Unity `2021.3` as its minimum version in `MCPForUnity/package.json`. Code that uses Unity API conditionals (`UNITY_2022_3_OR_NEWER`, `UNITY_2023_1_OR_NEWER`, `UNITY_6000_*`) should be tested against the affected editor line, not just the oldest supported version.
231
+
232
+
For compatibility PRs, note the exact editor versions you tested in the PR body. If a Git package URL is involved, include the resolved `packages-lock.json` hash.
233
+
234
+
## Troubleshooting During Development
235
+
236
+
-**Unity still loads an old Git package**: close Unity, check `Packages/packages-lock.json`, then refresh Package Manager. If needed, remove only the stale `Library/PackageCache/com.coplaydev.unity-mcp@<hash>` folder while Unity is closed.
237
+
-**Unity opens in Safe Mode after changing package source**: the package failed to compile before MCP can start. Fix the compile errors first; the MCP server cannot recover from package compile failures.
238
+
-**Server changes are not picked up**: make sure **Server Source Override** points to your local `Server/` directory and **Dev Mode (Force fresh server install)** is enabled.
239
+
-**Stdio tool visibility looks stale**: call `manage_tools(action="sync")` or restart the MCP session. HTTP mode can push `tools/list_changed` notifications automatically.
240
+
-**Multiple Unity editors are open**: use `mcpforunity://instances` and `set_active_instance` to confirm which project the server is targeting.
141
241
## Unity-version CI matrix
142
242
143
243
CI exercises the package across multiple Unity versions to catch breaks in `#if UNITY_*_OR_NEWER` branches. The matrix is configured in `tools/unity-versions.json` and consumed by `.github/workflows/unity-tests.yml`.
0 commit comments