From 57fb86fbca64e0478bff7c5c95466a126e7a6911 Mon Sep 17 00:00:00 2001 From: Shutong Wu <51266340+Scriptwonder@users.noreply.github.com> Date: Wed, 11 Feb 2026 17:02:45 -0500 Subject: [PATCH 1/2] Update for UI-based batch execution --- .claude/skills/unity-mcp-skill/SKILL.md | 1 + .../unity-mcp-skill/references/workflows.md | 407 ++++++++++++++++++ unity-mcp-skill/SKILL.md | 1 + unity-mcp-skill/references/workflows.md | 407 ++++++++++++++++++ 4 files changed, 816 insertions(+) diff --git a/.claude/skills/unity-mcp-skill/SKILL.md b/.claude/skills/unity-mcp-skill/SKILL.md index 40a8541d8..b9a76357e 100644 --- a/.claude/skills/unity-mcp-skill/SKILL.md +++ b/.claude/skills/unity-mcp-skill/SKILL.md @@ -124,6 +124,7 @@ uri="file:///full/path/to/file.cs" | **Editor** | `manage_editor`, `execute_menu_item`, `read_console` | Editor control | | **Testing** | `run_tests`, `get_test_job` | Unity Test Framework | | **Batch** | `batch_execute` | Parallel/bulk operations | +| **UI** | `batch_execute` with `manage_gameobject` + `manage_components` | Canvas, Panel, Button, Text, Slider, Toggle, Input Field (see [UI workflows](references/workflows.md#ui-creation-workflows)) | ## Common Workflows diff --git a/.claude/skills/unity-mcp-skill/references/workflows.md b/.claude/skills/unity-mcp-skill/references/workflows.md index f04245cf4..629becfa8 100644 --- a/.claude/skills/unity-mcp-skill/references/workflows.md +++ b/.claude/skills/unity-mcp-skill/references/workflows.md @@ -10,6 +10,7 @@ Common workflows and patterns for effective Unity-MCP usage. - [Asset Management Workflows](#asset-management-workflows) - [Testing Workflows](#testing-workflows) - [Debugging Workflows](#debugging-workflows) +- [UI Creation Workflows](#ui-creation-workflows) - [Batch Operations](#batch-operations) --- @@ -491,6 +492,412 @@ manage_scene(action="screenshot") --- +## UI Creation Workflows + +Unity UI (Canvas-based UGUI) requires specific component hierarchies. Use `batch_execute` with `fail_fast=True` to create complete UI elements in a single call. These templates handle the boilerplate so you don't need to remember which components each UI element needs. + +### Create Canvas (Foundation for All UI) + +Every UI element must be under a Canvas. A Canvas requires three components: `Canvas`, `CanvasScaler`, and `GraphicRaycaster`. + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "MainCanvas" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "MainCanvas", "component_type": "Canvas" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "MainCanvas", "component_type": "CanvasScaler" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "MainCanvas", "component_type": "GraphicRaycaster" + }}, + # renderMode: 0=ScreenSpaceOverlay, 1=ScreenSpaceCamera, 2=WorldSpace + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MainCanvas", + "component_type": "Canvas", "property": "renderMode", "value": 0 + }}, + # CanvasScaler: uiScaleMode 1=ScaleWithScreenSize + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MainCanvas", + "component_type": "CanvasScaler", "property": "uiScaleMode", "value": 1 + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MainCanvas", + "component_type": "CanvasScaler", "property": "referenceResolution", + "value": [1920, 1080] + }} +]) +``` + +### Create EventSystem (Required Once Per Scene for UI Interaction) + +If no EventSystem exists in the scene, buttons and other interactive UI elements won't respond to input. Create one alongside your first Canvas. + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "EventSystem" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "EventSystem", + "component_type": "UnityEngine.EventSystems.EventSystem" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "EventSystem", + "component_type": "UnityEngine.InputSystem.UI.InputSystemUIInputModule" + }} +]) +``` + +> **Note:** For projects using legacy Input Manager instead of Input System, use `"component_type": "UnityEngine.EventSystems.StandaloneInputModule"` instead. + +### Create Panel (Background Container) + +A Panel is an Image component used as a background/container for other UI elements. + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "MenuPanel", "parent": "MainCanvas" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "MenuPanel", "component_type": "Image" + }}, + # Set semi-transparent dark background + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MenuPanel", + "component_type": "Image", "property": "color", + "value": [0.1, 0.1, 0.1, 0.8] + }} +]) +``` + +### Create Text (TextMeshPro) + +TextMeshProUGUI automatically adds a RectTransform when added to a child of a Canvas. + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "TitleText", "parent": "MenuPanel" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "TitleText", + "component_type": "TextMeshProUGUI" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "TitleText", + "component_type": "TextMeshProUGUI", + "properties": { + "text": "My Game Title", + "fontSize": 48, + "alignment": 514, + "color": [1, 1, 1, 1] + } + }} +]) +``` + +> **TextMeshPro alignment values:** 257=TopLeft, 258=TopCenter, 260=TopRight, 513=MiddleLeft, 514=MiddleCenter, 516=MiddleRight, 1025=BottomLeft, 1026=BottomCenter, 1028=BottomRight. + +### Create Button (With Label) + +A Button needs an `Image` (visual) + `Button` (interaction) on the parent, and a child with `TextMeshProUGUI` for the label. + +```python +batch_execute(fail_fast=True, commands=[ + # Button container with Image + Button components + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "StartButton", "parent": "MenuPanel" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "StartButton", "component_type": "Image" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "StartButton", "component_type": "Button" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "StartButton", + "component_type": "Image", "property": "color", + "value": [0.2, 0.6, 1.0, 1.0] + }}, + # Child text label + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "StartButton_Label", "parent": "StartButton" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "StartButton_Label", + "component_type": "TextMeshProUGUI" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "StartButton_Label", + "component_type": "TextMeshProUGUI", + "properties": {"text": "Start Game", "fontSize": 24, "alignment": 514} + }} +]) +``` + +### Create Slider + +A Slider requires a specific hierarchy: the slider root, a background, a fill area with fill, and a handle area with handle. + +```python +batch_execute(fail_fast=True, commands=[ + # Slider root + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "HealthSlider", "parent": "MainCanvas" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "HealthSlider", "component_type": "Slider" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "HealthSlider", "component_type": "Image" + }}, + # Background + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Background", "parent": "HealthSlider" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Background", "component_type": "Image" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "Background", + "component_type": "Image", "property": "color", + "value": [0.3, 0.3, 0.3, 1.0] + }}, + # Fill Area + Fill + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Fill Area", "parent": "HealthSlider" + }}, + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Fill", "parent": "Fill Area" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Fill", "component_type": "Image" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "Fill", + "component_type": "Image", "property": "color", + "value": [0.2, 0.8, 0.2, 1.0] + }}, + # Handle Area + Handle + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Handle Slide Area", "parent": "HealthSlider" + }}, + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Handle", "parent": "Handle Slide Area" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Handle", "component_type": "Image" + }} +]) +``` + +### Create Input Field (TextMeshPro) + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "NameInput", "parent": "MenuPanel" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "NameInput", "component_type": "Image" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "NameInput", + "component_type": "TMP_InputField" + }}, + # Text area child + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Text Area", "parent": "NameInput" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Text Area", + "component_type": "RectMask2D" + }}, + # Placeholder + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Placeholder", "parent": "Text Area" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Placeholder", + "component_type": "TextMeshProUGUI" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "Placeholder", + "component_type": "TextMeshProUGUI", + "properties": {"text": "Enter name...", "fontStyle": 2, "color": [0.5, 0.5, 0.5, 0.5]} + }}, + # Actual text + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Text", "parent": "Text Area" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Text", + "component_type": "TextMeshProUGUI" + }} +]) +``` + +### Create Toggle (Checkbox) + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "SoundToggle", "parent": "MenuPanel" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "SoundToggle", "component_type": "Toggle" + }}, + # Background box + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Background", "parent": "SoundToggle" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Background", "component_type": "Image" + }}, + # Checkmark + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Checkmark", "parent": "Background" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Checkmark", "component_type": "Image" + }}, + # Label + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Label", "parent": "SoundToggle" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Label", "component_type": "TextMeshProUGUI" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "Label", + "component_type": "TextMeshProUGUI", + "properties": {"text": "Sound Effects", "fontSize": 18, "alignment": 513} + }} +]) +``` + +### Add Layout Group (Vertical/Horizontal/Grid) + +Layout groups auto-arrange child elements. Add to any container. + +```python +# Vertical layout for a menu panel +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_components", "params": { + "action": "add", "target": "MenuPanel", + "component_type": "VerticalLayoutGroup" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MenuPanel", + "component_type": "VerticalLayoutGroup", + "properties": { + "spacing": 10, + "childAlignment": 1, + "childForceExpandWidth": True, + "childForceExpandHeight": False + } + }}, + # Add ContentSizeFitter to auto-resize + {"tool": "manage_components", "params": { + "action": "add", "target": "MenuPanel", + "component_type": "ContentSizeFitter" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MenuPanel", + "component_type": "ContentSizeFitter", + "properties": { + "verticalFit": 2 + } + }} +]) +``` + +> **childAlignment values:** 0=UpperLeft, 1=UpperCenter, 2=UpperRight, 3=MiddleLeft, 4=MiddleCenter, 5=MiddleRight, 6=LowerLeft, 7=LowerCenter, 8=LowerRight. +> **ContentSizeFitter fit modes:** 0=Unconstrained, 1=MinSize, 2=PreferredSize. + +### Complete Example: Main Menu Screen + +Combines multiple templates into a full menu screen in two batch calls (25 command limit per batch). + +```python +# Batch 1: Canvas + EventSystem + Panel + Title +batch_execute(fail_fast=True, commands=[ + # Canvas + {"tool": "manage_gameobject", "params": {"action": "create", "name": "MenuCanvas"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "MenuCanvas", "component_type": "Canvas"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "MenuCanvas", "component_type": "CanvasScaler"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "MenuCanvas", "component_type": "GraphicRaycaster"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "MenuCanvas", "component_type": "Canvas", "property": "renderMode", "value": 0}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "MenuCanvas", "component_type": "CanvasScaler", "properties": {"uiScaleMode": 1, "referenceResolution": [1920, 1080]}}}, + # EventSystem + {"tool": "manage_gameobject", "params": {"action": "create", "name": "EventSystem"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "EventSystem", "component_type": "UnityEngine.EventSystems.EventSystem"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "EventSystem", "component_type": "UnityEngine.EventSystems.StandaloneInputModule"}}, + # Panel + {"tool": "manage_gameobject", "params": {"action": "create", "name": "MenuPanel", "parent": "MenuCanvas"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "MenuPanel", "component_type": "Image"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "MenuPanel", "component_type": "Image", "property": "color", "value": [0.1, 0.1, 0.15, 0.9]}}, + {"tool": "manage_components", "params": {"action": "add", "target": "MenuPanel", "component_type": "VerticalLayoutGroup"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "MenuPanel", "component_type": "VerticalLayoutGroup", "properties": {"spacing": 20, "childAlignment": 4, "childForceExpandWidth": True, "childForceExpandHeight": False}}}, + # Title + {"tool": "manage_gameobject", "params": {"action": "create", "name": "Title", "parent": "MenuPanel"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "Title", "component_type": "TextMeshProUGUI"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "Title", "component_type": "TextMeshProUGUI", "properties": {"text": "My Game", "fontSize": 64, "alignment": 514, "color": [1, 1, 1, 1]}}} +]) + +# Batch 2: Buttons +batch_execute(fail_fast=True, commands=[ + # Play Button + {"tool": "manage_gameobject", "params": {"action": "create", "name": "PlayButton", "parent": "MenuPanel"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "PlayButton", "component_type": "Image"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "PlayButton", "component_type": "Button"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "PlayButton", "component_type": "Image", "property": "color", "value": [0.2, 0.6, 1.0, 1.0]}}, + {"tool": "manage_gameobject", "params": {"action": "create", "name": "PlayButton_Label", "parent": "PlayButton"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "PlayButton_Label", "component_type": "TextMeshProUGUI"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "PlayButton_Label", "component_type": "TextMeshProUGUI", "properties": {"text": "Play", "fontSize": 32, "alignment": 514}}}, + # Settings Button + {"tool": "manage_gameobject", "params": {"action": "create", "name": "SettingsButton", "parent": "MenuPanel"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "SettingsButton", "component_type": "Image"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "SettingsButton", "component_type": "Button"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "SettingsButton", "component_type": "Image", "property": "color", "value": [0.3, 0.3, 0.35, 1.0]}}, + {"tool": "manage_gameobject", "params": {"action": "create", "name": "SettingsButton_Label", "parent": "SettingsButton"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "SettingsButton_Label", "component_type": "TextMeshProUGUI"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "SettingsButton_Label", "component_type": "TextMeshProUGUI", "properties": {"text": "Settings", "fontSize": 32, "alignment": 514}}}, + # Quit Button + {"tool": "manage_gameobject", "params": {"action": "create", "name": "QuitButton", "parent": "MenuPanel"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "QuitButton", "component_type": "Image"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "QuitButton", "component_type": "Button"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "QuitButton", "component_type": "Image", "property": "color", "value": [0.8, 0.2, 0.2, 1.0]}}, + {"tool": "manage_gameobject", "params": {"action": "create", "name": "QuitButton_Label", "parent": "QuitButton"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "QuitButton_Label", "component_type": "TextMeshProUGUI"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "QuitButton_Label", "component_type": "TextMeshProUGUI", "properties": {"text": "Quit", "fontSize": 32, "alignment": 514}}} +]) +``` + +### UI Component Quick Reference + +| UI Element | Required Components | Notes | +| ---------- | ------------------- | ----- | +| **Canvas** | Canvas + CanvasScaler + GraphicRaycaster | Root for all UI. One per screen. | +| **EventSystem** | EventSystem + StandaloneInputModule (or InputSystemUIInputModule) | One per scene. Required for interaction. | +| **Panel** | Image | Container. Set color for background. | +| **Text** | TextMeshProUGUI | Auto-adds RectTransform under Canvas. | +| **Button** | Image + Button + child(TextMeshProUGUI) | Image = visual, Button = click handler. | +| **Image** | Image | Set sprite property for custom graphics. | +| **Slider** | Slider + Image + children(Background, Fill Area/Fill, Handle Slide Area/Handle) | Complex hierarchy. | +| **Toggle** | Toggle + children(Background/Checkmark, Label) | Checkbox/radio button. | +| **Input Field** | Image + TMP_InputField + children(Text Area/Placeholder/Text) | Text input. | +| **Scroll View** | ScrollRect + Image + children(Viewport/Content, Scrollbar) | Scrollable container. | +| **Dropdown** | Image + TMP_Dropdown + children(Label, Arrow, Template) | Selection menu. | +| **Layout Group** | VerticalLayoutGroup / HorizontalLayoutGroup / GridLayoutGroup | Add to any container to auto-arrange children. | + +--- + ## Batch Operations ### Mass Property Update diff --git a/unity-mcp-skill/SKILL.md b/unity-mcp-skill/SKILL.md index 40a8541d8..b9a76357e 100644 --- a/unity-mcp-skill/SKILL.md +++ b/unity-mcp-skill/SKILL.md @@ -124,6 +124,7 @@ uri="file:///full/path/to/file.cs" | **Editor** | `manage_editor`, `execute_menu_item`, `read_console` | Editor control | | **Testing** | `run_tests`, `get_test_job` | Unity Test Framework | | **Batch** | `batch_execute` | Parallel/bulk operations | +| **UI** | `batch_execute` with `manage_gameobject` + `manage_components` | Canvas, Panel, Button, Text, Slider, Toggle, Input Field (see [UI workflows](references/workflows.md#ui-creation-workflows)) | ## Common Workflows diff --git a/unity-mcp-skill/references/workflows.md b/unity-mcp-skill/references/workflows.md index f04245cf4..629becfa8 100644 --- a/unity-mcp-skill/references/workflows.md +++ b/unity-mcp-skill/references/workflows.md @@ -10,6 +10,7 @@ Common workflows and patterns for effective Unity-MCP usage. - [Asset Management Workflows](#asset-management-workflows) - [Testing Workflows](#testing-workflows) - [Debugging Workflows](#debugging-workflows) +- [UI Creation Workflows](#ui-creation-workflows) - [Batch Operations](#batch-operations) --- @@ -491,6 +492,412 @@ manage_scene(action="screenshot") --- +## UI Creation Workflows + +Unity UI (Canvas-based UGUI) requires specific component hierarchies. Use `batch_execute` with `fail_fast=True` to create complete UI elements in a single call. These templates handle the boilerplate so you don't need to remember which components each UI element needs. + +### Create Canvas (Foundation for All UI) + +Every UI element must be under a Canvas. A Canvas requires three components: `Canvas`, `CanvasScaler`, and `GraphicRaycaster`. + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "MainCanvas" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "MainCanvas", "component_type": "Canvas" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "MainCanvas", "component_type": "CanvasScaler" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "MainCanvas", "component_type": "GraphicRaycaster" + }}, + # renderMode: 0=ScreenSpaceOverlay, 1=ScreenSpaceCamera, 2=WorldSpace + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MainCanvas", + "component_type": "Canvas", "property": "renderMode", "value": 0 + }}, + # CanvasScaler: uiScaleMode 1=ScaleWithScreenSize + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MainCanvas", + "component_type": "CanvasScaler", "property": "uiScaleMode", "value": 1 + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MainCanvas", + "component_type": "CanvasScaler", "property": "referenceResolution", + "value": [1920, 1080] + }} +]) +``` + +### Create EventSystem (Required Once Per Scene for UI Interaction) + +If no EventSystem exists in the scene, buttons and other interactive UI elements won't respond to input. Create one alongside your first Canvas. + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "EventSystem" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "EventSystem", + "component_type": "UnityEngine.EventSystems.EventSystem" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "EventSystem", + "component_type": "UnityEngine.InputSystem.UI.InputSystemUIInputModule" + }} +]) +``` + +> **Note:** For projects using legacy Input Manager instead of Input System, use `"component_type": "UnityEngine.EventSystems.StandaloneInputModule"` instead. + +### Create Panel (Background Container) + +A Panel is an Image component used as a background/container for other UI elements. + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "MenuPanel", "parent": "MainCanvas" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "MenuPanel", "component_type": "Image" + }}, + # Set semi-transparent dark background + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MenuPanel", + "component_type": "Image", "property": "color", + "value": [0.1, 0.1, 0.1, 0.8] + }} +]) +``` + +### Create Text (TextMeshPro) + +TextMeshProUGUI automatically adds a RectTransform when added to a child of a Canvas. + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "TitleText", "parent": "MenuPanel" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "TitleText", + "component_type": "TextMeshProUGUI" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "TitleText", + "component_type": "TextMeshProUGUI", + "properties": { + "text": "My Game Title", + "fontSize": 48, + "alignment": 514, + "color": [1, 1, 1, 1] + } + }} +]) +``` + +> **TextMeshPro alignment values:** 257=TopLeft, 258=TopCenter, 260=TopRight, 513=MiddleLeft, 514=MiddleCenter, 516=MiddleRight, 1025=BottomLeft, 1026=BottomCenter, 1028=BottomRight. + +### Create Button (With Label) + +A Button needs an `Image` (visual) + `Button` (interaction) on the parent, and a child with `TextMeshProUGUI` for the label. + +```python +batch_execute(fail_fast=True, commands=[ + # Button container with Image + Button components + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "StartButton", "parent": "MenuPanel" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "StartButton", "component_type": "Image" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "StartButton", "component_type": "Button" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "StartButton", + "component_type": "Image", "property": "color", + "value": [0.2, 0.6, 1.0, 1.0] + }}, + # Child text label + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "StartButton_Label", "parent": "StartButton" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "StartButton_Label", + "component_type": "TextMeshProUGUI" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "StartButton_Label", + "component_type": "TextMeshProUGUI", + "properties": {"text": "Start Game", "fontSize": 24, "alignment": 514} + }} +]) +``` + +### Create Slider + +A Slider requires a specific hierarchy: the slider root, a background, a fill area with fill, and a handle area with handle. + +```python +batch_execute(fail_fast=True, commands=[ + # Slider root + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "HealthSlider", "parent": "MainCanvas" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "HealthSlider", "component_type": "Slider" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "HealthSlider", "component_type": "Image" + }}, + # Background + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Background", "parent": "HealthSlider" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Background", "component_type": "Image" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "Background", + "component_type": "Image", "property": "color", + "value": [0.3, 0.3, 0.3, 1.0] + }}, + # Fill Area + Fill + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Fill Area", "parent": "HealthSlider" + }}, + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Fill", "parent": "Fill Area" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Fill", "component_type": "Image" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "Fill", + "component_type": "Image", "property": "color", + "value": [0.2, 0.8, 0.2, 1.0] + }}, + # Handle Area + Handle + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Handle Slide Area", "parent": "HealthSlider" + }}, + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Handle", "parent": "Handle Slide Area" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Handle", "component_type": "Image" + }} +]) +``` + +### Create Input Field (TextMeshPro) + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "NameInput", "parent": "MenuPanel" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "NameInput", "component_type": "Image" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "NameInput", + "component_type": "TMP_InputField" + }}, + # Text area child + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Text Area", "parent": "NameInput" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Text Area", + "component_type": "RectMask2D" + }}, + # Placeholder + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Placeholder", "parent": "Text Area" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Placeholder", + "component_type": "TextMeshProUGUI" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "Placeholder", + "component_type": "TextMeshProUGUI", + "properties": {"text": "Enter name...", "fontStyle": 2, "color": [0.5, 0.5, 0.5, 0.5]} + }}, + # Actual text + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Text", "parent": "Text Area" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Text", + "component_type": "TextMeshProUGUI" + }} +]) +``` + +### Create Toggle (Checkbox) + +```python +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "SoundToggle", "parent": "MenuPanel" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "SoundToggle", "component_type": "Toggle" + }}, + # Background box + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Background", "parent": "SoundToggle" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Background", "component_type": "Image" + }}, + # Checkmark + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Checkmark", "parent": "Background" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Checkmark", "component_type": "Image" + }}, + # Label + {"tool": "manage_gameobject", "params": { + "action": "create", "name": "Label", "parent": "SoundToggle" + }}, + {"tool": "manage_components", "params": { + "action": "add", "target": "Label", "component_type": "TextMeshProUGUI" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "Label", + "component_type": "TextMeshProUGUI", + "properties": {"text": "Sound Effects", "fontSize": 18, "alignment": 513} + }} +]) +``` + +### Add Layout Group (Vertical/Horizontal/Grid) + +Layout groups auto-arrange child elements. Add to any container. + +```python +# Vertical layout for a menu panel +batch_execute(fail_fast=True, commands=[ + {"tool": "manage_components", "params": { + "action": "add", "target": "MenuPanel", + "component_type": "VerticalLayoutGroup" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MenuPanel", + "component_type": "VerticalLayoutGroup", + "properties": { + "spacing": 10, + "childAlignment": 1, + "childForceExpandWidth": True, + "childForceExpandHeight": False + } + }}, + # Add ContentSizeFitter to auto-resize + {"tool": "manage_components", "params": { + "action": "add", "target": "MenuPanel", + "component_type": "ContentSizeFitter" + }}, + {"tool": "manage_components", "params": { + "action": "set_property", "target": "MenuPanel", + "component_type": "ContentSizeFitter", + "properties": { + "verticalFit": 2 + } + }} +]) +``` + +> **childAlignment values:** 0=UpperLeft, 1=UpperCenter, 2=UpperRight, 3=MiddleLeft, 4=MiddleCenter, 5=MiddleRight, 6=LowerLeft, 7=LowerCenter, 8=LowerRight. +> **ContentSizeFitter fit modes:** 0=Unconstrained, 1=MinSize, 2=PreferredSize. + +### Complete Example: Main Menu Screen + +Combines multiple templates into a full menu screen in two batch calls (25 command limit per batch). + +```python +# Batch 1: Canvas + EventSystem + Panel + Title +batch_execute(fail_fast=True, commands=[ + # Canvas + {"tool": "manage_gameobject", "params": {"action": "create", "name": "MenuCanvas"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "MenuCanvas", "component_type": "Canvas"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "MenuCanvas", "component_type": "CanvasScaler"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "MenuCanvas", "component_type": "GraphicRaycaster"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "MenuCanvas", "component_type": "Canvas", "property": "renderMode", "value": 0}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "MenuCanvas", "component_type": "CanvasScaler", "properties": {"uiScaleMode": 1, "referenceResolution": [1920, 1080]}}}, + # EventSystem + {"tool": "manage_gameobject", "params": {"action": "create", "name": "EventSystem"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "EventSystem", "component_type": "UnityEngine.EventSystems.EventSystem"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "EventSystem", "component_type": "UnityEngine.EventSystems.StandaloneInputModule"}}, + # Panel + {"tool": "manage_gameobject", "params": {"action": "create", "name": "MenuPanel", "parent": "MenuCanvas"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "MenuPanel", "component_type": "Image"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "MenuPanel", "component_type": "Image", "property": "color", "value": [0.1, 0.1, 0.15, 0.9]}}, + {"tool": "manage_components", "params": {"action": "add", "target": "MenuPanel", "component_type": "VerticalLayoutGroup"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "MenuPanel", "component_type": "VerticalLayoutGroup", "properties": {"spacing": 20, "childAlignment": 4, "childForceExpandWidth": True, "childForceExpandHeight": False}}}, + # Title + {"tool": "manage_gameobject", "params": {"action": "create", "name": "Title", "parent": "MenuPanel"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "Title", "component_type": "TextMeshProUGUI"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "Title", "component_type": "TextMeshProUGUI", "properties": {"text": "My Game", "fontSize": 64, "alignment": 514, "color": [1, 1, 1, 1]}}} +]) + +# Batch 2: Buttons +batch_execute(fail_fast=True, commands=[ + # Play Button + {"tool": "manage_gameobject", "params": {"action": "create", "name": "PlayButton", "parent": "MenuPanel"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "PlayButton", "component_type": "Image"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "PlayButton", "component_type": "Button"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "PlayButton", "component_type": "Image", "property": "color", "value": [0.2, 0.6, 1.0, 1.0]}}, + {"tool": "manage_gameobject", "params": {"action": "create", "name": "PlayButton_Label", "parent": "PlayButton"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "PlayButton_Label", "component_type": "TextMeshProUGUI"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "PlayButton_Label", "component_type": "TextMeshProUGUI", "properties": {"text": "Play", "fontSize": 32, "alignment": 514}}}, + # Settings Button + {"tool": "manage_gameobject", "params": {"action": "create", "name": "SettingsButton", "parent": "MenuPanel"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "SettingsButton", "component_type": "Image"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "SettingsButton", "component_type": "Button"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "SettingsButton", "component_type": "Image", "property": "color", "value": [0.3, 0.3, 0.35, 1.0]}}, + {"tool": "manage_gameobject", "params": {"action": "create", "name": "SettingsButton_Label", "parent": "SettingsButton"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "SettingsButton_Label", "component_type": "TextMeshProUGUI"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "SettingsButton_Label", "component_type": "TextMeshProUGUI", "properties": {"text": "Settings", "fontSize": 32, "alignment": 514}}}, + # Quit Button + {"tool": "manage_gameobject", "params": {"action": "create", "name": "QuitButton", "parent": "MenuPanel"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "QuitButton", "component_type": "Image"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "QuitButton", "component_type": "Button"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "QuitButton", "component_type": "Image", "property": "color", "value": [0.8, 0.2, 0.2, 1.0]}}, + {"tool": "manage_gameobject", "params": {"action": "create", "name": "QuitButton_Label", "parent": "QuitButton"}}, + {"tool": "manage_components", "params": {"action": "add", "target": "QuitButton_Label", "component_type": "TextMeshProUGUI"}}, + {"tool": "manage_components", "params": {"action": "set_property", "target": "QuitButton_Label", "component_type": "TextMeshProUGUI", "properties": {"text": "Quit", "fontSize": 32, "alignment": 514}}} +]) +``` + +### UI Component Quick Reference + +| UI Element | Required Components | Notes | +| ---------- | ------------------- | ----- | +| **Canvas** | Canvas + CanvasScaler + GraphicRaycaster | Root for all UI. One per screen. | +| **EventSystem** | EventSystem + StandaloneInputModule (or InputSystemUIInputModule) | One per scene. Required for interaction. | +| **Panel** | Image | Container. Set color for background. | +| **Text** | TextMeshProUGUI | Auto-adds RectTransform under Canvas. | +| **Button** | Image + Button + child(TextMeshProUGUI) | Image = visual, Button = click handler. | +| **Image** | Image | Set sprite property for custom graphics. | +| **Slider** | Slider + Image + children(Background, Fill Area/Fill, Handle Slide Area/Handle) | Complex hierarchy. | +| **Toggle** | Toggle + children(Background/Checkmark, Label) | Checkbox/radio button. | +| **Input Field** | Image + TMP_InputField + children(Text Area/Placeholder/Text) | Text input. | +| **Scroll View** | ScrollRect + Image + children(Viewport/Content, Scrollbar) | Scrollable container. | +| **Dropdown** | Image + TMP_Dropdown + children(Label, Arrow, Template) | Selection menu. | +| **Layout Group** | VerticalLayoutGroup / HorizontalLayoutGroup / GridLayoutGroup | Add to any container to auto-arrange children. | + +--- + ## Batch Operations ### Mass Property Update From 2751bc50325cf5936713f6d9836a2223bf992ef8 Mon Sep 17 00:00:00 2001 From: Shutong Wu <51266340+Scriptwonder@users.noreply.github.com> Date: Wed, 11 Feb 2026 19:16:11 -0500 Subject: [PATCH 2/2] Add template notice --- .claude/skills/unity-mcp-skill/SKILL.md | 14 ++++++++++++-- .../unity-mcp-skill/references/tools-reference.md | 6 +++++- .../skills/unity-mcp-skill/references/workflows.md | 9 ++++++++- unity-mcp-skill/SKILL.md | 14 ++++++++++++-- unity-mcp-skill/references/tools-reference.md | 6 +++++- unity-mcp-skill/references/workflows.md | 9 ++++++++- 6 files changed, 50 insertions(+), 8 deletions(-) diff --git a/.claude/skills/unity-mcp-skill/SKILL.md b/.claude/skills/unity-mcp-skill/SKILL.md index b9a76357e..cd12f7fc9 100644 --- a/.claude/skills/unity-mcp-skill/SKILL.md +++ b/.claude/skills/unity-mcp-skill/SKILL.md @@ -7,6 +7,14 @@ description: Orchestrate Unity Editor via MCP (Model Context Protocol) tools and This skill helps you effectively use the Unity Editor with MCP tools and resources. +## Template Notice + +Examples in `references/workflows.md` and `references/tools-reference.md` are reusable templates. They may be inaccurate across Unity versions, package setups (UGUI/TMP/Input System), and project-specific conventions. Please check console, compilation errors, or use screenshot after implementation. + +Before applying a template: +- Validate targets/components first via resources and `find_gameobjects`. +- Treat names, enum values, and property payloads as placeholders to adapt. + ## Quick Start: Resource-First Workflow **Always read relevant resources before using tools.** This prevents errors and provides the necessary context. @@ -41,11 +49,11 @@ batch_execute( {"tool": "manage_gameobject", "params": {"action": "create", "name": "Cube2", "primitive_type": "Cube"}}, {"tool": "manage_gameobject", "params": {"action": "create", "name": "Cube3", "primitive_type": "Cube"}} ], - parallel=True # Read-only operations can run in parallel + parallel=True # Hint only: Unity may still execute sequentially ) ``` -**Max 25 commands per batch.** Use `fail_fast=True` for dependent operations. +**Max 25 commands per batch.** Use `fail_fast=True` for dependent operations. Batches are not transactional (no rollback on partial failure). ### 3. Use `screenshot` in manage_scene to Verify Visual Results @@ -82,6 +90,8 @@ read_console( ## Parameter Type Conventions +These are common patterns, not strict guarantees. `manage_components.set_property` payload shapes can vary by component/property; if a template fails, inspect the component resource payload and adjust. + ### Vectors (position, rotation, scale, color) ```python # Both forms accepted: diff --git a/.claude/skills/unity-mcp-skill/references/tools-reference.md b/.claude/skills/unity-mcp-skill/references/tools-reference.md index f4d75555f..229fa7f4a 100644 --- a/.claude/skills/unity-mcp-skill/references/tools-reference.md +++ b/.claude/skills/unity-mcp-skill/references/tools-reference.md @@ -2,6 +2,8 @@ Complete reference for all MCP tools. Each tool includes parameters, types, and usage examples. +> **Template warning:** Examples in this file are skill templates and may be inaccurate for some Unity versions, packages, or project setups. Validate parameters and payload shapes against your active tool schema and runtime behavior. + ## Table of Contents - [Infrastructure Tools](#infrastructure-tools) @@ -27,12 +29,14 @@ batch_execute( {"tool": "tool_name", "params": {...}}, ... ], - parallel=False, # bool, optional - run read-only ops in parallel + parallel=False, # bool, optional - advisory only (Unity may still run sequentially) fail_fast=False, # bool, optional - stop on first failure max_parallelism=None # int, optional - max parallel workers ) ``` +`batch_execute` is not transactional: earlier commands are not rolled back if a later command fails. + ### set_active_instance Route commands to a specific Unity instance (multi-instance workflows). diff --git a/.claude/skills/unity-mcp-skill/references/workflows.md b/.claude/skills/unity-mcp-skill/references/workflows.md index 629becfa8..631c4a0e4 100644 --- a/.claude/skills/unity-mcp-skill/references/workflows.md +++ b/.claude/skills/unity-mcp-skill/references/workflows.md @@ -494,7 +494,14 @@ manage_scene(action="screenshot") ## UI Creation Workflows -Unity UI (Canvas-based UGUI) requires specific component hierarchies. Use `batch_execute` with `fail_fast=True` to create complete UI elements in a single call. These templates handle the boilerplate so you don't need to remember which components each UI element needs. +Unity UI (Canvas-based UGUI) requires specific component hierarchies. Use `batch_execute` with `fail_fast=True` to create complete UI elements in a single call. + +> **Template warning:** This section is a skill template library, not a guaranteed source of truth. Examples may be inaccurate for your Unity version, package setup, or project conventions. +> **Use safely:** +> 1. Validate component/property names against the current project. +> 2. Prefer targeting by instance ID or full path over generic names. +> 3. Assume complex controls (Slider/Toggle/TMP Input) may need extra reference wiring. +> 4. Treat numeric enum values as placeholders and verify before reuse. ### Create Canvas (Foundation for All UI) diff --git a/unity-mcp-skill/SKILL.md b/unity-mcp-skill/SKILL.md index b9a76357e..0097d7a1a 100644 --- a/unity-mcp-skill/SKILL.md +++ b/unity-mcp-skill/SKILL.md @@ -7,6 +7,14 @@ description: Orchestrate Unity Editor via MCP (Model Context Protocol) tools and This skill helps you effectively use the Unity Editor with MCP tools and resources. +## Template + +Examples in `references/workflows.md` and `references/tools-reference.md` are reusable templates. They may be inaccurate across Unity versions, package setups (UGUI/TMP/Input System), and project-specific conventions. Please check console, compilation errors, or use screenshot after implementation. + +Before applying a template: +- Validate targets/components first via resources and `find_gameobjects`. +- Treat names, enum values, and property payloads as placeholders to adapt. + ## Quick Start: Resource-First Workflow **Always read relevant resources before using tools.** This prevents errors and provides the necessary context. @@ -41,11 +49,11 @@ batch_execute( {"tool": "manage_gameobject", "params": {"action": "create", "name": "Cube2", "primitive_type": "Cube"}}, {"tool": "manage_gameobject", "params": {"action": "create", "name": "Cube3", "primitive_type": "Cube"}} ], - parallel=True # Read-only operations can run in parallel + parallel=True # Hint only: Unity may still execute sequentially ) ``` -**Max 25 commands per batch.** Use `fail_fast=True` for dependent operations. +**Max 25 commands per batch.** Use `fail_fast=True` for dependent operations. Batches are not transactional (no rollback on partial failure). ### 3. Use `screenshot` in manage_scene to Verify Visual Results @@ -82,6 +90,8 @@ read_console( ## Parameter Type Conventions +These are common patterns, not strict guarantees. `manage_components.set_property` payload shapes can vary by component/property; if a template fails, inspect the component resource payload and adjust. + ### Vectors (position, rotation, scale, color) ```python # Both forms accepted: diff --git a/unity-mcp-skill/references/tools-reference.md b/unity-mcp-skill/references/tools-reference.md index f4d75555f..229fa7f4a 100644 --- a/unity-mcp-skill/references/tools-reference.md +++ b/unity-mcp-skill/references/tools-reference.md @@ -2,6 +2,8 @@ Complete reference for all MCP tools. Each tool includes parameters, types, and usage examples. +> **Template warning:** Examples in this file are skill templates and may be inaccurate for some Unity versions, packages, or project setups. Validate parameters and payload shapes against your active tool schema and runtime behavior. + ## Table of Contents - [Infrastructure Tools](#infrastructure-tools) @@ -27,12 +29,14 @@ batch_execute( {"tool": "tool_name", "params": {...}}, ... ], - parallel=False, # bool, optional - run read-only ops in parallel + parallel=False, # bool, optional - advisory only (Unity may still run sequentially) fail_fast=False, # bool, optional - stop on first failure max_parallelism=None # int, optional - max parallel workers ) ``` +`batch_execute` is not transactional: earlier commands are not rolled back if a later command fails. + ### set_active_instance Route commands to a specific Unity instance (multi-instance workflows). diff --git a/unity-mcp-skill/references/workflows.md b/unity-mcp-skill/references/workflows.md index 629becfa8..631c4a0e4 100644 --- a/unity-mcp-skill/references/workflows.md +++ b/unity-mcp-skill/references/workflows.md @@ -494,7 +494,14 @@ manage_scene(action="screenshot") ## UI Creation Workflows -Unity UI (Canvas-based UGUI) requires specific component hierarchies. Use `batch_execute` with `fail_fast=True` to create complete UI elements in a single call. These templates handle the boilerplate so you don't need to remember which components each UI element needs. +Unity UI (Canvas-based UGUI) requires specific component hierarchies. Use `batch_execute` with `fail_fast=True` to create complete UI elements in a single call. + +> **Template warning:** This section is a skill template library, not a guaranteed source of truth. Examples may be inaccurate for your Unity version, package setup, or project conventions. +> **Use safely:** +> 1. Validate component/property names against the current project. +> 2. Prefer targeting by instance ID or full path over generic names. +> 3. Assume complex controls (Slider/Toggle/TMP Input) may need extra reference wiring. +> 4. Treat numeric enum values as placeholders and verify before reuse. ### Create Canvas (Foundation for All UI)