[skill update] Update for UI instructions in the skills#726
[skill update] Update for UI instructions in the skills#726Scriptwonder merged 2 commits intoCoplayDev:betafrom
Conversation
Reviewer's GuideAdds comprehensive documentation for creating Unity UGUI-based UI via batch_execute, including new UI Creation Workflows section and a UI category in the SKILL overview, duplicated for both the checked-in and .claude versions of the Unity MCP skill docs. Flow diagram for batch_execute based UI creation workflowsflowchart TD
start["Design UI to create"] --> chooseBatch["Use batch_execute with fail_fast=True"]
chooseBatch --> createCanvas["Create Canvas GameObject"]
createCanvas --> addCanvasComp["Add Canvas, CanvasScaler, GraphicRaycaster components"]
addCanvasComp --> configCanvas["Set Canvas renderMode and CanvasScaler properties"]
chooseBatch --> checkEventSystem["Check for existing EventSystem in scene"]
checkEventSystem --> hasEventSystem{EventSystem exists?}
hasEventSystem -->|No| createEventSystem["Create EventSystem GameObject"]
createEventSystem --> addEventComponents["Add EventSystem + input module components"]
hasEventSystem -->|Yes| skipEventSystem["Skip EventSystem creation"]
configCanvas --> createUIContainer["Create container under Canvas (e.g. MenuPanel)"]
createUIContainer --> addPanelImage["Add Image component for panel background"]
createUIContainer --> addLayoutGroup["Optionally add LayoutGroup and ContentSizeFitter"]
addPanelImage --> addChildren["Create child UI elements"]
subgraph Child_UI_Elements
addChildren --> btnBranch["Create Button hierarchy"]
btnBranch --> btnRoot["Create Button GameObject under panel"]
btnRoot --> btnComponents["Add Image + Button components"]
btnComponents --> btnLabelGO["Create label child GameObject"]
btnLabelGO --> btnLabelTMP["Add TextMeshProUGUI and set text/alignment"]
addChildren --> textBranch["Create standalone text"]
textBranch --> textGO["Create Text GameObject under panel"]
textGO --> textTMP["Add TextMeshProUGUI and set properties"]
addChildren --> sliderBranch["Create Slider hierarchy"]
sliderBranch --> sliderRoot["Create Slider root under Canvas or panel"]
sliderRoot --> sliderComponents["Add Slider + Image components"]
sliderComponents --> sliderBG["Create Background with Image"]
sliderComponents --> sliderFillArea["Create Fill Area/Fill with Image"]
sliderComponents --> sliderHandleArea["Create Handle Slide Area/Handle with Image"]
addChildren --> inputBranch["Create Input Field hierarchy"]
inputBranch --> inputRoot["Create Input root under panel"]
inputRoot --> inputComponents["Add Image + TMP_InputField"]
inputComponents --> inputTextArea["Create Text Area with RectMask2D"]
inputTextArea --> inputPlaceholder["Create Placeholder with TextMeshProUGUI"]
inputTextArea --> inputText["Create Text with TextMeshProUGUI"]
addChildren --> toggleBranch["Create Toggle hierarchy"]
toggleBranch --> toggleRoot["Create Toggle root under panel"]
toggleRoot --> toggleComp["Add Toggle component"]
toggleComp --> toggleBG["Create Background with Image"]
toggleBG --> toggleCheck["Create Checkmark with Image"]
toggleRoot --> toggleLabelGO["Create Label with TextMeshProUGUI"]
end
btnLabelTMP --> endBatch["Complete batch_execute call"]
textTMP --> endBatch
sliderHandleArea --> endBatch
inputText --> endBatch
toggleLabelGO --> endBatch
skipEventSystem --> createUIContainer
addEventComponents --> createUIContainer
Flow diagram for Unity UGUI main menu hierarchy created via batch_executeflowchart TD
subgraph Scene
MenuCanvas["MenuCanvas GameObject"]
EventSystem["EventSystem GameObject"]
end
%% Canvas components
MenuCanvas --> CanvasComp["Canvas component"]
MenuCanvas --> CanvasScalerComp["CanvasScaler component"]
MenuCanvas --> GraphicRaycasterComp["GraphicRaycaster component"]
CanvasComp --> CanvasRenderMode["renderMode = ScreenSpaceOverlay (0)"]
CanvasScalerComp --> CanvasScaleProps["uiScaleMode = ScaleWithScreenSize (1)\nreferenceResolution = [1920, 1080]"]
%% EventSystem components
EventSystem --> EventSystemComp["EventSystem component"]
EventSystem --> InputModuleComp["StandaloneInputModule or InputSystemUIInputModule"]
%% Panel hierarchy
MenuCanvas --> MenuPanel["MenuPanel GameObject"]
MenuPanel --> MenuPanelImage["Image component (background)"]
MenuPanel --> MenuPanelLayout["VerticalLayoutGroup component"]
MenuPanelLayout --> MenuPanelLayoutProps["spacing = 20\nchildAlignment = MiddleCenter (4)\nchildForceExpandWidth = True\nchildForceExpandHeight = False"]
%% Title
MenuPanel --> Title["Title GameObject"]
Title --> TitleTMP["TextMeshProUGUI component"]
TitleTMP --> TitleProps["text = My Game\nfontSize = 64\nalignment = MiddleCenter (514)\ncolor = [1, 1, 1, 1]"]
%% Play button
MenuPanel --> PlayButton["PlayButton GameObject"]
PlayButton --> PlayButtonImage["Image component"]
PlayButtonImage --> PlayButtonColor["color = [0.2, 0.6, 1.0, 1.0]"]
PlayButton --> PlayButtonComp["Button component"]
PlayButton --> PlayButtonLabel["PlayButton_Label GameObject"]
PlayButtonLabel --> PlayButtonLabelTMP["TextMeshProUGUI component"]
PlayButtonLabelTMP --> PlayButtonLabelProps["text = Play\nfontSize = 32\nalignment = MiddleCenter (514)"]
%% Settings button
MenuPanel --> SettingsButton["SettingsButton GameObject"]
SettingsButton --> SettingsButtonImage["Image component"]
SettingsButtonImage --> SettingsButtonColor["color = [0.3, 0.3, 0.35, 1.0]"]
SettingsButton --> SettingsButtonComp["Button component"]
SettingsButton --> SettingsButtonLabel["SettingsButton_Label GameObject"]
SettingsButtonLabel --> SettingsButtonLabelTMP["TextMeshProUGUI component"]
SettingsButtonLabelTMP --> SettingsButtonLabelProps["text = Settings\nfontSize = 32\nalignment = MiddleCenter (514)"]
%% Quit button
MenuPanel --> QuitButton["QuitButton GameObject"]
QuitButton --> QuitButtonImage["Image component"]
QuitButtonImage --> QuitButtonColor["color = [0.8, 0.2, 0.2, 1.0]"]
QuitButton --> QuitButtonComp["Button component"]
QuitButton --> QuitButtonLabel["QuitButton_Label GameObject"]
QuitButtonLabel --> QuitButtonLabelTMP["TextMeshProUGUI component"]
QuitButtonLabelTMP --> QuitButtonLabelProps["text = Quit\nfontSize = 32\nalignment = MiddleCenter (514)"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📝 WalkthroughWalkthroughAdds UI Creation Workflows and a UI category to Unity-MCP documentation, inserts a template warning/notice, and clarifies Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new UI workflow section is duplicated verbatim in both
.claude/skills/unity-mcp-skill/references/workflows.mdandunity-mcp-skill/references/workflows.md; consider a single source of truth (or a generation step) to avoid future drift between the two copies. - Since many of the examples rely on
batch_executeand mention the 25-command limit only in the final example, it might be helpful to briefly call out near the top of the UI section that some patterns may need to be split into multiple batches in more complex real-world uses.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new UI workflow section is duplicated verbatim in both `.claude/skills/unity-mcp-skill/references/workflows.md` and `unity-mcp-skill/references/workflows.md`; consider a single source of truth (or a generation step) to avoid future drift between the two copies.
- Since many of the examples rely on `batch_execute` and mention the 25-command limit only in the final example, it might be helpful to briefly call out near the top of the UI section that some patterns may need to be split into multiple batches in more complex real-world uses.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In @.claude/skills/unity-mcp-skill/references/workflows.md:
- Around line 535-556: The guidance and example for creating an EventSystem are
inconsistent: the prose recommends using
UnityEngine.InputSystem.UI.InputSystemUIInputModule but the example adds
UnityEngine.EventSystems.StandaloneInputModule; update the example (the
batch_execute call that uses manage_gameobject and manage_components targeting
"EventSystem") so the component_type matches the written guidance, or add a
brief clarifying note next to the example that shows both options and when to
use UnityEngine.InputSystem.UI.InputSystemUIInputModule versus
UnityEngine.EventSystems.StandaloneInputModule (legacy Input Manager). Also
apply the same fix to the other occurrence referenced (lines ~823-841) so both
examples and notes are consistent.
- Around line 643-742: The Slider/Toggle/TMP_InputField hierarchies are missing
required serialized references so the UI controls won't work; after creating the
GameObjects/components (e.g., HealthSlider, Background, Fill Area/Fill, Handle
Slide Area/Handle, NameInput, Text Area, Placeholder, Text) add
manage_components steps to set the component reference fields: for Slider set
fillRect to "Fill" RectTransform and handleRect to "Handle" RectTransform (on
the Slider component), for Toggle set targetGraphic and graphic to the
appropriate Image components (e.g., Background/Checkmark), and for
TMP_InputField set textViewport to "Text Area" RectTransform, textComponent to
"Text" TextMeshProUGUI and placeholder to "Placeholder" TextMeshProUGUI using
manage_components action "set_property" (or equivalent) targeting the specific
component types (Slider, Toggle, TMP_InputField) to wire those fields.
In `@unity-mcp-skill/references/workflows.md`:
- Around line 535-556: The documentation currently recommends using
UnityEngine.InputSystem.UI.InputSystemUIInputModule for projects using the new
Input System but the example snippet adds
UnityEngine.EventSystems.StandaloneInputModule instead; update the example
inside the EventSystem section so the manage_components call that adds the input
module uses UnityEngine.InputSystem.UI.InputSystemUIInputModule to match the
guidance (or add a concise conditional note immediately after the snippet that
shows which component to use per input system and references both
UnityEngine.InputSystems.UI.InputSystemUIInputModule and
UnityEngine.EventSystems.StandaloneInputModule to avoid confusion); ensure the
same correction is applied to the other occurrence mentioned (lines ~823-841)
and keep the batch_execute/manage_components structure unchanged.
- Around line 643-742: The Slider/Toggle/TMP_InputField templates create the
GameObject hierarchy but never wire required component references, so add
follow-up manage_components "set_property" commands to assign those fields: for
Slider on "HealthSlider" set fillRect to the RectTransform of "Fill", handleRect
to the RectTransform of "Handle", and targetGraphic to the Image on
"Background"; for Toggle set targetGraphic/graphic to the appropriate
Image/Graphic objects you create; for TMP_InputField on "NameInput" set
textViewport to the RectTransform of "Text Area", textComponent to the
TextMeshProUGUI on "Text", and placeholder to the TextMeshProUGUI on
"Placeholder" (use the component targets and property names like fillRect,
handleRect, targetGraphic, textViewport, textComponent, placeholder in
manage_components set_property entries); place these set_property commands
immediately after the components are added so the controls function and render
correctly.
| ### 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. | ||
|
|
There was a problem hiding this comment.
Align InputSystem vs legacy input module guidance.
The EventSystem section recommends InputSystemUIInputModule, but the complete example uses StandaloneInputModule. Please make the example match the guidance or add a short note indicating which one to use per input system.
Also applies to: 823-841
🤖 Prompt for AI Agents
In @.claude/skills/unity-mcp-skill/references/workflows.md around lines 535 -
556, The guidance and example for creating an EventSystem are inconsistent: the
prose recommends using UnityEngine.InputSystem.UI.InputSystemUIInputModule but
the example adds UnityEngine.EventSystems.StandaloneInputModule; update the
example (the batch_execute call that uses manage_gameobject and
manage_components targeting "EventSystem") so the component_type matches the
written guidance, or add a brief clarifying note next to the example that shows
both options and when to use UnityEngine.InputSystem.UI.InputSystemUIInputModule
versus UnityEngine.EventSystems.StandaloneInputModule (legacy Input Manager).
Also apply the same fix to the other occurrence referenced (lines ~823-841) so
both examples and notes are consistent.
| ### 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" | ||
| }} | ||
| ]) |
There was a problem hiding this comment.
Wire required component references for Slider/Toggle/TMP_InputField.
These templates build the hierarchy but don’t assign required references on the components (e.g., Slider fillRect/handleRect, Toggle targetGraphic/graphic, TMP_InputField textViewport/textComponent/placeholder). As written, the controls won’t function or render correctly unless those fields are wired. Please add manage_components steps (or an explicit note) to assign those references after creation.
Also applies to: 745-781
🤖 Prompt for AI Agents
In @.claude/skills/unity-mcp-skill/references/workflows.md around lines 643 -
742, The Slider/Toggle/TMP_InputField hierarchies are missing required
serialized references so the UI controls won't work; after creating the
GameObjects/components (e.g., HealthSlider, Background, Fill Area/Fill, Handle
Slide Area/Handle, NameInput, Text Area, Placeholder, Text) add
manage_components steps to set the component reference fields: for Slider set
fillRect to "Fill" RectTransform and handleRect to "Handle" RectTransform (on
the Slider component), for Toggle set targetGraphic and graphic to the
appropriate Image components (e.g., Background/Checkmark), and for
TMP_InputField set textViewport to "Text Area" RectTransform, textComponent to
"Text" TextMeshProUGUI and placeholder to "Placeholder" TextMeshProUGUI using
manage_components action "set_property" (or equivalent) targeting the specific
component types (Slider, Toggle, TMP_InputField) to wire those fields.
| ### 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. | ||
|
|
There was a problem hiding this comment.
Align InputSystem vs legacy input module guidance.
The EventSystem section recommends InputSystemUIInputModule, but the complete example uses StandaloneInputModule. Please make the example match the guidance or add a short note indicating which one to use per input system.
Also applies to: 823-841
🤖 Prompt for AI Agents
In `@unity-mcp-skill/references/workflows.md` around lines 535 - 556, The
documentation currently recommends using
UnityEngine.InputSystem.UI.InputSystemUIInputModule for projects using the new
Input System but the example snippet adds
UnityEngine.EventSystems.StandaloneInputModule instead; update the example
inside the EventSystem section so the manage_components call that adds the input
module uses UnityEngine.InputSystem.UI.InputSystemUIInputModule to match the
guidance (or add a concise conditional note immediately after the snippet that
shows which component to use per input system and references both
UnityEngine.InputSystems.UI.InputSystemUIInputModule and
UnityEngine.EventSystems.StandaloneInputModule to avoid confusion); ensure the
same correction is applied to the other occurrence mentioned (lines ~823-841)
and keep the batch_execute/manage_components structure unchanged.
| ### 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" | ||
| }} | ||
| ]) |
There was a problem hiding this comment.
Wire required component references for Slider/Toggle/TMP_InputField.
These templates build the hierarchy but don’t assign required references on the components (e.g., Slider fillRect/handleRect, Toggle targetGraphic/graphic, TMP_InputField textViewport/textComponent/placeholder). As written, the controls won’t function or render correctly unless those fields are wired. Please add manage_components steps (or an explicit note) to assign those references after creation.
Also applies to: 745-781
🤖 Prompt for AI Agents
In `@unity-mcp-skill/references/workflows.md` around lines 643 - 742, The
Slider/Toggle/TMP_InputField templates create the GameObject hierarchy but never
wire required component references, so add follow-up manage_components
"set_property" commands to assign those fields: for Slider on "HealthSlider" set
fillRect to the RectTransform of "Fill", handleRect to the RectTransform of
"Handle", and targetGraphic to the Image on "Background"; for Toggle set
targetGraphic/graphic to the appropriate Image/Graphic objects you create; for
TMP_InputField on "NameInput" set textViewport to the RectTransform of "Text
Area", textComponent to the TextMeshProUGUI on "Text", and placeholder to the
TextMeshProUGUI on "Placeholder" (use the component targets and property names
like fillRect, handleRect, targetGraphic, textViewport, textComponent,
placeholder in manage_components set_property entries); place these set_property
commands immediately after the components are added so the controls function and
render correctly.
There was a problem hiding this comment.
Pull request overview
Adds UI-focused workflow documentation so an LLM can reliably construct Unity UGUI hierarchies via batch_execute using existing atomic tools (manage_gameobject, manage_components), and surfaces the new UI guidance in the skill index.
Changes:
- Added a new “UI Creation Workflows” section with batch templates for common UGUI elements (Canvas, EventSystem, Panel, Text, Button, Slider, Input Field, Toggle, Layout Groups).
- Updated the workflows table of contents to include the new UI section.
- Updated
SKILL.mdtool category table to point readers to the UI workflows.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 13 comments.
| File | Description |
|---|---|
unity-mcp-skill/references/workflows.md |
Adds UI creation workflow templates and a quick reference table. |
unity-mcp-skill/SKILL.md |
Adds a UI row linking to the new UI workflows section. |
.claude/skills/unity-mcp-skill/references/workflows.md |
Mirrors the same UI workflow documentation for the Claude skill copy. |
.claude/skills/unity-mcp-skill/SKILL.md |
Mirrors the same UI row/link update for the Claude skill copy. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | **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)) | |
There was a problem hiding this comment.
The PR description says “Only update the .skill files”, but this PR changes SKILL.md and references/workflows.md (documentation). Please update the PR description to reflect the actual scope (or adjust the change list) to avoid reviewer confusion.
| ```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" | ||
| }} |
There was a problem hiding this comment.
This EventSystem example uses UnityEngine.InputSystem.UI.InputSystemUIInputModule, but the later “Complete Example” uses StandaloneInputModule, and the note implies Standalone is the legacy fallback. Please make these consistent (pick one default module and use it in both places), and consider defaulting the snippet to the module that’s always available in projects that don’t have the Input System package installed.
| ### 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": { |
There was a problem hiding this comment.
The Slider template creates the expected child objects, but it never assigns the Slider’s required references (e.g., fillRect, handleRect, and often targetGraphic). Without these, the slider may not display or update correctly. Consider adding steps (possibly using paths like HealthSlider/Fill Area/Fill and HealthSlider/Handle Slide Area/Handle) to set these properties, or explicitly call out that manual wiring is needed after creation.
| ### 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" | ||
| }}, |
There was a problem hiding this comment.
For TMP_InputField, creating the child hierarchy isn’t sufficient for a functional input field—the component typically needs references assigned for its text/placeholder/viewport fields (e.g., textComponent, placeholder, textViewport). Consider adding set_property steps to wire these up (using stable paths), or note that these references must be set after creation to avoid a broken control.
| ```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" | ||
| }} |
There was a problem hiding this comment.
This EventSystem example uses UnityEngine.InputSystem.UI.InputSystemUIInputModule, but the later “Complete Example” uses StandaloneInputModule, and the note implies Standalone is the legacy fallback. Please make these consistent (pick one default module and use it in both places), and consider defaulting the snippet to the module that’s always available in projects that don’t have the Input System package installed.
|
|
||
| ### Create Text (TextMeshPro) | ||
|
|
||
| TextMeshProUGUI automatically adds a RectTransform when added to a child of a Canvas. |
There was a problem hiding this comment.
Minor accuracy nit: TextMeshProUGUI (and other UGUI components) typically requires a RectTransform regardless of whether the object is already a child of a Canvas; Unity will replace Transform with RectTransform when adding the component. Consider rephrasing to avoid implying it only happens under a Canvas.
| TextMeshProUGUI automatically adds a RectTransform when added to a child of a Canvas. | |
| TextMeshProUGUI requires a RectTransform; when you add this component, Unity will automatically replace a standard Transform with a RectTransform if needed. |
|
|
||
| ## 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. |
There was a problem hiding this comment.
The UI section states these templates create “complete UI elements”, but for several UGUI controls (e.g., Slider/Toggle/TMP_InputField) the components also require serialized references (like fillRect/handleRect, targetGraphic/graphic, textComponent/placeholder/textViewport). As written, the objects/hierarchy will be created but the controls may not render or behave correctly. Either add follow-up manage_components(action="set_property") steps to wire these references, or adjust the wording to clarify that additional reference wiring is required.
| 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 the basic hierarchy and components for common UI elements in a single call. These templates handle most of the boilerplate so you don't need to remember which components each UI element needs, but some controls (for example `Slider`, `Toggle`, or `TMP_InputField`) still require additional `manage_components(action="set_property")` steps to wire serialized references like `fillRect`, `handleRect`, `targetGraphic`, `graphic`, `textComponent`, `placeholder`, or `textViewport`. |
| ### 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": { |
There was a problem hiding this comment.
The Slider template creates the expected child objects, but it never assigns the Slider’s required references (e.g., fillRect, handleRect, and often targetGraphic). Without these, the slider may not display or update correctly. Consider adding steps (possibly using paths like HealthSlider/Fill Area/Fill and HealthSlider/Handle Slide Area/Handle) to set these properties, or explicitly call out that manual wiring is needed after creation.
| ### 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" | ||
| }}, |
There was a problem hiding this comment.
For TMP_InputField, creating the child hierarchy isn’t sufficient for a functional input field—the component typically needs references assigned for its text/placeholder/viewport fields (e.g., textComponent, placeholder, textViewport). Consider adding set_property steps to wire these up (using stable paths), or note that these references must be set after creation to avoid a broken control.
|
|
||
| ### Create Text (TextMeshPro) | ||
|
|
||
| TextMeshProUGUI automatically adds a RectTransform when added to a child of a Canvas. |
There was a problem hiding this comment.
Minor accuracy nit: TextMeshProUGUI (and other UGUI components) typically requires a RectTransform regardless of whether the object is already a child of a Canvas; Unity will replace Transform with RectTransform when adding the component. Consider rephrasing to avoid implying it only happens under a Canvas.
| TextMeshProUGUI automatically adds a RectTransform when added to a child of a Canvas. | |
| TextMeshProUGUI (like most UGUI components) requires a RectTransform; when you add it, Unity automatically replaces a standard Transform with a RectTransform if needed. |
* Update for UI-based batch execution * Add template notice
* Update for UI-based batch execution * Add template notice
Description
Add UI-based descriptions for LLM to understand how to draw batch requests to generate UI
Type of Change
Save your change type
Changes Made
Only update the .skill files. I am really not sure if I should add more token usage to this big MCP server with a manage_ui (our current MCP tool took around 10% of the Opus4.6 context window, which is not small), since ui apis are basically using atomic operations from manage_component. We can implement further UI operations, but that can also be taken care of by manage_component. right?
@msanatan @dsarno, love to hear what you guys think about this tradeoff between context/usage and more power/features.
Testing/Screenshots/Recordings
Documentation Updates
tools/UPDATE_DOCS_PROMPT.md(recommended)tools/UPDATE_DOCS.mdRelated Issues
Additional Notes
Summary by Sourcery
Document UI creation workflows for Unity-MCP and reference them from the Unity skill metadata.
Documentation:
Summary by CodeRabbit