Skip to content

Commit b2d95d2

Browse files
Merge pull request #943 from CoplayDev/release/v9.6.0
chore: bump version to 9.6.0
2 parents a7c715f + 53cefb1 commit b2d95d2

83 files changed

Lines changed: 7496 additions & 441 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/unity-mcp-skill/SKILL.md

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,26 @@ Before applying a template:
2424
2. Understand the scene → mcpforunity://scene/gameobject-api
2525
3. Find what you need → find_gameobjects or resources
2626
4. Take action → tools (manage_gameobject, create_script, script_apply_edits, apply_text_edits, validate_script, delete_script, get_sha, etc.)
27-
5. Verify results → read_console, capture_screenshot (in manage_scene), resources
27+
5. Verify results → read_console, manage_camera(action="screenshot"), resources
2828
```
2929

3030
## Critical Best Practices
3131

32-
### 1. After Writing/Editing Scripts: Always Refresh and Check Console
32+
### 1. After Writing/Editing Scripts: Wait for Compilation and Check Console
3333

3434
```python
3535
# After create_script or script_apply_edits:
36-
refresh_unity(mode="force", scope="scripts", compile="request", wait_for_ready=True)
36+
# Both tools already trigger AssetDatabase.ImportAsset + RequestScriptCompilation automatically.
37+
# No need to call refresh_unity — just wait for compilation to finish, then check console.
38+
39+
# 1. Poll editor state until compilation completes
40+
# Read mcpforunity://editor/state → wait until is_compiling == false
41+
42+
# 2. Check for compilation errors
3743
read_console(types=["error"], count=10, include_stacktrace=True)
3844
```
3945

40-
**Why:** Unity must compile scripts before they're usable. Compilation errors block all tool execution.
46+
**Why:** Unity must compile scripts before they're usable. `create_script` and `script_apply_edits` already trigger import and compilation automatically — calling `refresh_unity` afterward is redundant.
4147

4248
### 2. Use `batch_execute` for Multiple Operations
4349

@@ -55,44 +61,61 @@ batch_execute(
5561

5662
**Max 25 commands per batch by default (configurable in Unity MCP Tools window, max 100).** Use `fail_fast=True` for dependent operations.
5763

64+
**Tip:** Also use `batch_execute` for discovery — batch multiple `find_gameobjects` calls instead of calling them one at a time:
65+
```python
66+
batch_execute(commands=[
67+
{"tool": "find_gameobjects", "params": {"search_term": "Camera", "search_method": "by_component"}},
68+
{"tool": "find_gameobjects", "params": {"search_term": "Player", "search_method": "by_tag"}},
69+
{"tool": "find_gameobjects", "params": {"search_term": "GameManager", "search_method": "by_name"}}
70+
])
71+
```
72+
5873
### 3. Use Screenshots to Verify Visual Results
5974

6075
```python
6176
# Basic screenshot (saves to Assets/, returns file path only)
62-
manage_scene(action="screenshot")
77+
manage_camera(action="screenshot")
6378

6479
# Inline screenshot (returns base64 PNG directly to the AI)
65-
manage_scene(action="screenshot", include_image=True)
80+
manage_camera(action="screenshot", include_image=True)
6681

6782
# Use a specific camera and cap resolution for smaller payloads
68-
manage_scene(action="screenshot", camera="MainCamera", include_image=True, max_resolution=512)
83+
manage_camera(action="screenshot", camera="MainCamera", include_image=True, max_resolution=512)
6984

7085
# Batch surround: captures front/back/left/right/top/bird_eye around the scene
71-
manage_scene(action="screenshot", batch="surround", max_resolution=256)
86+
manage_camera(action="screenshot", batch="surround", max_resolution=256)
7287

7388
# Batch surround centered on a specific object
74-
manage_scene(action="screenshot", batch="surround", look_at="Player", max_resolution=256)
89+
manage_camera(action="screenshot", batch="surround", view_target="Player", max_resolution=256)
7590

7691
# Positioned screenshot: place a temp camera and capture in one call
77-
manage_scene(action="screenshot", look_at="Player", view_position=[0, 10, -10], max_resolution=512)
92+
manage_camera(action="screenshot", view_target="Player", view_position=[0, 10, -10], max_resolution=512)
93+
94+
# Scene View screenshot: capture what the developer sees in the editor
95+
manage_camera(action="screenshot", capture_source="scene_view", include_image=True)
96+
97+
# Scene View framed on a specific object
98+
manage_camera(action="screenshot", capture_source="scene_view", view_target="Canvas", include_image=True)
7899
```
79100

80101
**Best practices for AI scene understanding:**
81102
- Use `include_image=True` when you need to *see* the scene, not just save a file.
82103
- Use `batch="surround"` for a comprehensive overview (6 angles, one command).
83-
- Use `look_at`/`view_position` to capture from a specific viewpoint without needing a scene camera.
104+
- Use `view_target`/`view_position` to capture from a specific viewpoint without needing a scene camera.
105+
- Use `capture_source="scene_view"` to see the editor viewport (gizmos, wireframes, grid).
84106
- Keep `max_resolution` at 256–512 to balance quality vs. token cost.
85-
- Combine with `look_at` on `manage_gameobject` to orient a game camera before capturing.
86107

87108
```python
88109
# Agentic camera loop: point, shoot, analyze
89110
manage_gameobject(action="look_at", target="MainCamera", look_at_target="Player")
90-
manage_scene(action="screenshot", camera="MainCamera", include_image=True, max_resolution=512)
111+
manage_camera(action="screenshot", camera="MainCamera", include_image=True, max_resolution=512)
91112
# → Analyze image, decide next action
92113

93-
# Alternative: use manage_camera for screenshot (same underlying infrastructure)
94-
manage_camera(action="screenshot", camera="FollowCam", include_image=True, max_resolution=512)
95-
manage_camera(action="screenshot_multiview", max_resolution=480) # 6-angle contact sheet
114+
# Multi-view screenshot (6-angle contact sheet)
115+
manage_camera(action="screenshot_multiview", max_resolution=480)
116+
117+
# Scene View for editor-level inspection (shows gizmos, debug overlays, etc.)
118+
manage_camera(action="screenshot", capture_source="scene_view", view_target="Player", include_image=True)
96119
```
97120

98121
### 4. Check Console After Major Changes
@@ -157,30 +180,31 @@ uri="file:///full/path/to/file.cs"
157180
|----------|-----------|---------|
158181
| **Scene** | `manage_scene`, `find_gameobjects` | Scene operations, finding objects |
159182
| **Objects** | `manage_gameobject`, `manage_components` | Creating/modifying GameObjects |
160-
| **Scripts** | `create_script`, `script_apply_edits`, `refresh_unity` | C# code management |
161-
| **Assets** | `manage_asset`, `manage_prefabs` | Asset operations |
183+
| **Scripts** | `create_script`, `script_apply_edits`, `validate_script` | C# code management (auto-refreshes on create/edit) |
184+
| **Assets** | `manage_asset`, `manage_prefabs` | Asset operations. **Prefab instantiation** is done via `manage_gameobject(action="create", prefab_path="...")`, not `manage_prefabs`. |
162185
| **Editor** | `manage_editor`, `execute_menu_item`, `read_console` | Editor control, package deployment (`deploy_package`/`restore_package` actions) |
163186
| **Testing** | `run_tests`, `get_test_job` | Unity Test Framework |
164187
| **Batch** | `batch_execute` | Parallel/bulk operations |
165188
| **Camera** | `manage_camera` | Camera management (Unity Camera + Cinemachine). **Tier 1** (always available): create, target, lens, priority, list, screenshot. **Tier 2** (requires `com.unity.cinemachine`): brain, body/aim/noise pipeline, extensions, blending, force/release. 7 presets: follow, third_person, freelook, dolly, static, top_down, side_scroller. Resource: `mcpforunity://scene/cameras`. Use `ping` to check Cinemachine availability. See [tools-reference.md](references/tools-reference.md#camera-tools). |
166189
| **Graphics** | `manage_graphics` | Rendering and post-processing management. 33 actions across 5 groups: **Volume** (create/configure volumes and effects, URP/HDRP), **Bake** (lightmaps, light probes, reflection probes, Edit mode only), **Stats** (draw calls, batches, memory), **Pipeline** (quality levels, pipeline settings), **Features** (URP renderer features: add, remove, toggle, reorder). Resources: `mcpforunity://scene/volumes`, `mcpforunity://rendering/stats`, `mcpforunity://pipeline/renderer-features`. Use `ping` to check pipeline status. See [tools-reference.md](references/tools-reference.md#graphics-tools). |
167-
| **Packages** | `query_packages` (read-only), `manage_packages` (mutating) | Install, remove, search, and manage Unity packages and scoped registries. `query_packages`: list installed, search registry, get info, ping, poll status. `manage_packages`: add/remove packages, embed for editing, add/remove scoped registries, force resolve. Validates identifiers, warns on git URLs, checks dependents before removal (`force=true` to override). See [tools-reference.md](references/tools-reference.md#package-tools). |
190+
| **Packages** | `manage_packages` | Install, remove, search, and manage Unity packages and scoped registries. Query actions: list installed, search registry, get info, ping, poll status. Mutating actions: add/remove packages, embed for editing, add/remove scoped registries, force resolve. Validates identifiers, warns on git URLs, checks dependents before removal (`force=true` to override). See [tools-reference.md](references/tools-reference.md#package-tools). |
168191
| **ProBuilder** | `manage_probuilder` | 3D modeling, mesh editing, complex geometry. **When `com.unity.probuilder` is installed, prefer ProBuilder shapes over primitive GameObjects** for editable geometry, multi-material faces, or complex shapes. Supports 12 shape types, face/edge/vertex editing, smoothing, and per-face materials. See [ProBuilder Guide](references/probuilder-guide.md). |
169192
| **UI** | `manage_ui`, `batch_execute` with `manage_gameobject` + `manage_components` | **UI Toolkit**: Use `manage_ui` to create UXML/USS files, attach UIDocument, inspect visual trees. **uGUI (Canvas)**: Use `batch_execute` for Canvas, Panel, Button, Text, Slider, Toggle, Input Field. **Read `mcpforunity://project/info` first** to detect uGUI/TMP/Input System/UI Toolkit availability. (see [UI workflows](references/workflows.md#ui-creation-workflows)) |
193+
| **Docs** | `unity_reflect`, `unity_docs` | API verification and documentation lookup. **`unity_reflect`** inspects live C# APIs via reflection (requires Unity connection): `search` types across assemblies, `get_type` for member summary, `get_member` for full signatures. **`unity_docs`** fetches official docs from docs.unity3d.com (no Unity connection needed): `get_doc` (ScriptReference), `get_manual` (Manual pages), `get_package_doc` (package docs), `lookup` (parallel search all sources + project assets). **Trust hierarchy: reflection > project assets > docs.** Workflow: `unity_reflect` search -> get_type -> get_member -> `unity_docs` lookup. See [tools-reference.md](references/tools-reference.md#docs-tools). |
170194

171195
## Common Workflows
172196

173197
### Creating a New Script and Using It
174198

175199
```python
176-
# 1. Create the script
200+
# 1. Create the script (automatically triggers import + compilation)
177201
create_script(
178202
path="Assets/Scripts/PlayerController.cs",
179203
contents="using UnityEngine;\n\npublic class PlayerController : MonoBehaviour\n{\n void Update() { }\n}"
180204
)
181205

182-
# 2. CRITICAL: Refresh and wait for compilation
183-
refresh_unity(mode="force", scope="scripts", compile="request", wait_for_ready=True)
206+
# 2. Wait for compilation to finish
207+
# Read mcpforunity://editor/state → wait until is_compiling == false
184208

185209
# 3. Check for compilation errors
186210
read_console(types=["error"], count=10)

0 commit comments

Comments
 (0)