AgentSkillsCN

unity-mcp-tools

当用户询问“MCP工具”、“Unity MCP”、“启用工具组”、“哪些MCP工具”、“创建GameObject”、“添加组件”、“运行Unity测试”、“检查场景层级”、“为Unity生成代理”、“MCP无法工作”或需要通过MCP协调Unity编辑器操作时,应使用此技能。

SKILL.md
--- frontmatter
name: unity-mcp-tools
description: This skill should be used when the user asks about "MCP tools", "Unity MCP", "enable tool groups", "which MCP tools", "create GameObject", "add component", "run Unity tests", "check scene hierarchy", "spawn agent for Unity", "MCP not working", or needs to coordinate Unity Editor operations via MCP.
version: 0.3.0

Unity MCP Tools

Expert knowledge for coordinating Unity MCP operations, including tool enablement, agent orchestration, and direct MCP tool usage.

Quick Start: MCP Workflow

1. Inspect First (Always Available)

CRITICAL: The MCP Resource is ALWAYS enabled and never disabled - no tool enablement needed. This is the primary way agents inspect Unity.

How to Access (works for all agents including subagents):

text
Tool: ReadMcpResourceTool
Server: ai-game-developer
URI: unity://gameobject/{scene}/{path}

Example:

json
{
  "server": "ai-game-developer",
  "uri": "unity://gameobject/GameplayScene/TileManager"
}

Returns: Transform, components, properties, children

Resource vs Tools Decision Table:

NeedUse
Inspect scene structureMCP Resource (always available)
Read component valuesMCP Resource (always available)
Create/modify objectsMCP Tools (require enablement)
Run testsMCP Tools (require enablement)

Most agents should use this resource for read operations before enabling any tools.

2. Enable Tools When Modification Needed

Run /unity-mcp-enable [groups] before instructing agents that need MCP to fulfill a task.

3. Spawn Agent with Skills

Include unity-mcp-tools skill for agents doing MCP work:

TaskEnable GroupsSpawn Agent
Create/modify GameObjectsgameobject, componentscene-builder
Add UI elementsgameobject, componentui-ux-developer
Run teststestingtest-engineer
Work with scriptsscriptcode-architect
Create prefabsprefab, gameobjectscene-builder
Deploy build(none)deployment-specialist

4. Cleanup After MCP Work

Run /unity-mcp-reset to disable tools and save context.

Commands Reference

Subagents cannot use these commands, but claude code can trigger them or ask the user to use them.

CommandPurpose
/unity-mcp-statusShow enabled groups
/unity-mcp-enable [groups]Enable tool groups
/unity-mcp-enable-allEnable all tools
/unity-mcp-resetDisable all tools
/unity-mcp-scene-info [path]Query scene via Resource

When to Consult mcp-advisor

Spawn the mcp-advisor advisory agent when:

  • Unsure which tool groups are needed
  • MCP tools returning errors
  • Complex multi-step Unity operations
  • Need troubleshooting help

Example prompt: "What MCP tool groups do I need to add a health bar UI?"

The mcp-advisor returns recommendations - it does not execute commands.

Agent Skill Assignments

When spawning agents, include these skills:

AgentSkills to Include
scene-builderunity-mcp-tools, layout-sizing, visual-style-guide
test-engineerunity-mcp-tools, unity-testing
ui-ux-developerlayout-sizing, visual-style-guide
input-developerboard-sdk, unity-mcp-tools
code-architectproject-architecture
game-designerzero-day-rules
deployment-specialist(none - uses Bash)
project-producerdocumentation
mcp-advisorunity-mcp-tools

Subagent MCP Access

Subagents can use MCP tools directly when:

  1. Tools are enabled in AI-Game-Developer-Config.json
  2. Agent inherits tools (omit tools: field in frontmatter)

To give MCP access, omit the tools field:

yaml
---
name: scene-builder
skills: unity-mcp-tools, layout-sizing
# No tools field = inherits ALL including MCP
---

Subagent Constraints

CAN DoCANNOT Do
Use MCP Resource anytime (always available)Run /unity-mcp-enable commands
Use MCP Tools when enabled by orchestratorRun /unity-mcp-reset commands
Request orchestrator enable specific groupsEnable or disable tools for themselves

If MCP tools aren't working: Report to orchestrator which tool groups you need enabled (e.g., "Need gameobject and component groups").

Tool Groups Reference

Use /unity-mcp-enable [group] to enable. Multiple: /unity-mcp-enable gameobject component

Core Groups and Tools (11 total)

GroupToolsUse Case
scene-readscene-get-data, scene-list-opened, console-get-logsInspect scene hierarchy
scene-writescene-create, scene-save, scene-open, scene-set-active, scene-unload, console-get-logsModify scenes
gameobjectgameobject-create, gameobject-find, gameobject-modify, gameobject-destroy, gameobject-duplicate, gameobject-set-parent, scene-save, console-get-logsGameObject operations
componentgameobject-component-add, gameobject-component-get, gameobject-component-modify, gameobject-component-destroy, component-list, scene-save, console-get-logsComponent operations
scriptscript-read, script-update-or-create, script-delete, script-execute, assets-refresh, editor-application-get-state, console-get-logsScript operations
prefabassets-prefab-create, assets-prefab-instantiate, assets-prefab-open, assets-prefab-save, assets-prefab-close, assets-refresh, editor-application-get-state, console-get-logsPrefab operations
assetsassets-find, assets-create-folder, assets-copy, assets-move, assets-delete, assets-get-data, assets-modify, assets-refresh, assets-material-create, assets-shader-list-all, console-get-logsAsset management
testingtests-run, editor-application-get-state, console-get-logsRun Unity tests
editoreditor-application-get-state, editor-application-set-state, console-get-logs, editor-selection-get, editor-selection-setFull editor control
packagespackage-list, package-add, package-remove, package-search, console-get-logsPackage management
reflectionreflection-method-find, reflection-method-call, console-get-logsAdvanced operations

Cross-cutting Utilities (Auto-included)

ToolAuto-included with
console-get-logsALL groups
editor-application-get-statescript, testing, prefab
assets-refreshscript, prefab
scene-savegameobject, component

Common Patterns

Create GameObject with Components

  1. Enable: /unity-mcp-enable gameobject component
  2. Use gameobject-create to create object
  3. Use gameobject-component-add to add components
  4. Use gameobject-component-modify to configure

Run Tests After Code Changes

  1. Enable: /unity-mcp-enable testing
  2. Use tests-run with testMode: "EditMode" or "PlayMode"
  3. Check results, fix failures

Inspect Before Modifying

Always use MCP Resource first (no enablement):

  • /unity-mcp-scene-info {path} to understand structure
  • Then enable tools only if modification needed

Configuration

Config file: Assets/Resources/AI-Game-Developer-Config.json

Structure:

json
{
  "tools": [{ "name": "tool-name", "enabled": true/false }],
  "resources": [{ "name": "GameObject from Current Scene by Path", "enabled": true }]
}

The MCP Resource is always enabled. Tools default to disabled.

Reference Files

This skill's references/ folder contains complete MCP documentation organized for efficient navigation.

Main Guides (4 files)

FileContainsRead When
mcp-setup.mdMCP server startup, connection verificationSetting up or troubleshooting MCP
tool-groups.md11 tool groups with JSON definitionsUnderstanding group configurations
tool-reference.mdAll 49 MCP tools organized by categoryNeed specific tool usage details
troubleshooting.mdConnection issues, tool errors, common fixesMCP not working as expected

Tool Parameter Reference (11 files in tool-parameters/)

Detailed parameters and examples for each tool category:

FileTools Covered
scene-tools.mdscene-get-data, scene-create, scene-save, etc.
gameobject-tools.mdgameobject-create, gameobject-find, gameobject-modify
component-tools.mdcomponent-add, component-get, component-modify
script-tools.mdscript-read, script-update-or-create, script-execute
asset-tools.mdassets-find, assets-copy, assets-move, assets-delete
prefab-tools.mdprefab-create, prefab-instantiate, prefab-open
editor-tools.mdeditor-application-get-state, editor-selection
testing-tools.mdtests-run with testMode, filters, options
package-tools.mdpackage-list, package-add, package-remove
reflection-tools.mdreflection-method-find, reflection-method-call
material-shader-tools.mdassets-material-create, assets-shader-list-all

Related Documentation

  • Documentation/Unity-MCP-Documentation.md - Full MCP setup guide
  • .mcp.json - Connection configuration
  • Assets/Resources/AI-Game-Developer-Config.json - Tool enablement config