Unity UI Skills
BATCH-FIRST: Use
when creating 2+ UI elements.
Guardrails
Mode: Full-Auto required
DO NOT (common hallucinations):
- is the correct name — NOT
- does not exist → use
- does not exist → use
- does not exist → use on Image/Text component
- Do not confuse UGUI (this module) with UI Toolkit (uitoolkit module)
Routing:
- For UI Toolkit (UXML/USS) → use module
- For XR-compatible UI → use module's to convert Canvas to World Space
- For text updates → (this module)
- For layout arrangement → , ,
Skills Overview
| Single Object | Batch Version | Use Batch When |
|---|
| | Creating 2+ UI elements |
Query/Utility Skills:
- - Update text content
- - Find UI elements
- - Set RectTransform size/position
- - Set anchor preset
- - Arrange children in layout
- - Align selected elements
- - Distribute selected elements
- - Set Image properties (type/fill/sprite)
- - Add/configure LayoutElement
- - Add/configure CanvasGroup
- - Add Mask or RectMask2D
- - Add Shadow/Outline effect
- - Configure Selectable colors/transition/navigation
Single-Object Skills
ui_create_canvas
Create a UI Canvas container.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Canvas" | Canvas name |
| string | No | "ScreenSpaceOverlay" | ScreenSpaceOverlay/ScreenSpaceCamera/WorldSpace |
ui_create_panel
Create a Panel container.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Panel" | Panel name |
| string | No | null | Parent Canvas/object |
| float | No | 1,1,1,0.5 | Background color |
| float | No | 200 | Size in pixels |
ui_create_button
Create a Button.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Button" | Button name |
| string | No | null | Parent object |
| string | No | "Button" | Button label |
| float | No | 160/30 | Size |
| float | No | 0 | Position offset |
ui_create_text
Create a Text element.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Text" | Text name |
| string | No | null | Parent object |
| string | No | "Text" | Content |
| int | No | 24 | Font size |
| float | No | 0,0,0,1 | Text color |
| float | No | 200/50 | Size |
ui_create_image
Create an Image element.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Image" | Image name |
| string | No | null | Parent object |
| string | No | null | Sprite asset path |
| float | No | 1,1,1,1 | Tint color |
| float | No | 100 | Size |
ui_create_inputfield
Create an InputField.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "InputField" | Field name |
| string | No | null | Parent object |
| string | No | "Enter text..." | Placeholder |
| float | No | 200/30 | Size |
ui_create_slider
Create a Slider.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Slider" | Slider name |
| string | No | null | Parent object |
| float | No | 0 | Minimum value |
| float | No | 1 | Maximum value |
| float | No | 0.5 | Initial value |
| float | No | 160/20 | Size |
ui_create_toggle
Create a Toggle/Checkbox.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Toggle" | Toggle name |
| string | No | null | Parent object |
| string | No | "Toggle" | Label text |
| bool | No | false | Initial state |
ui_set_text
Update text content.
| Parameter | Type | Required | Description |
|---|
| string | Yes | Text object name |
| string | Yes | New content |
ui_find_all
Find UI elements in scene.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | null | Filter: Button/Text/Image/etc. |
| int | No | 100 | Max results |
ui_set_rect
Set RectTransform size, position, and padding.
| Parameter | Type | Required | Description |
|---|
| string | No* | UI element name |
| int | No* | Instance ID |
| , | float | No | Size |
| , | float | No | Position |
| , , , | float | No | Padding offsets |
ui_set_anchor
Set anchor preset for a UI element.
| Parameter | Type | Required | Default | Description |
|---|
| string | No* | - | UI element name |
| int | No* | - | Instance ID |
| string | No | "MiddleCenter" | Anchor preset |
| bool | No | true | Also set pivot |
Presets: TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight, StretchHorizontal, StretchVertical, StretchAll
ui_layout_children
Arrange child UI elements in a layout.
| Parameter | Type | Required | Default | Description |
|---|
| string | No* | - | Parent element name |
| int | No* | - | Instance ID |
| string | No | "Vertical" | Layout type |
| float | No | 10 | Spacing between elements |
Layout types: Vertical, Horizontal, Grid
ui_align_selected
Align selected UI elements.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Center" | Alignment type |
Alignments: Left, Center, Right, Top, Middle, Bottom
ui_distribute_selected
Distribute selected UI elements evenly.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Horizontal" | Distribution direction |
Batch Skill
ui_create_batch
Create multiple UI elements in one call.
| Parameter | Type | Required | Description |
|---|
| array | Yes | Array of UI element configs |
Item properties:
(required),
,
,
,
,
,
,
,
,
,
,
, etc.
Supported types: Button, Text, Image, Panel, Slider, Toggle, InputField, Dropdown, ScrollView, RawImage, Scrollbar
Returns:
{success, totalItems, successCount, failCount, results: [{success, name, type, instanceId}]}
python
unity_skills.call_skill("ui_create_batch", items=[
{"type": "Button", "name": "StartBtn", "parent": "MenuPanel", "text": "Start", "y": 60},
{"type": "Button", "name": "OptionsBtn", "parent": "MenuPanel", "text": "Options", "y": 0},
{"type": "Button", "name": "QuitBtn", "parent": "MenuPanel", "text": "Quit", "y": -60}
])
Example: Efficient Menu Creation
python
import unity_skills
# BAD: 5 API calls
unity_skills.call_skill("ui_create_canvas", name="MainMenu")
unity_skills.call_skill("ui_create_panel", name="MenuPanel", parent="MainMenu")
unity_skills.call_skill("ui_create_button", name="StartBtn", parent="MenuPanel", text="Start", y=60)
unity_skills.call_skill("ui_create_button", name="OptionsBtn", parent="MenuPanel", text="Options", y=0)
unity_skills.call_skill("ui_create_button", name="QuitBtn", parent="MenuPanel", text="Quit", y=-60)
# GOOD: 2 API calls
unity_skills.call_skill("ui_create_canvas", name="MainMenu")
unity_skills.call_skill("ui_create_batch", items=[
{"type": "Panel", "name": "MenuPanel", "parent": "MainMenu", "width": 300, "height": 200},
{"type": "Button", "name": "StartBtn", "parent": "MenuPanel", "text": "Start", "y": 60},
{"type": "Button", "name": "OptionsBtn", "parent": "MenuPanel", "text": "Options", "y": 0},
{"type": "Button", "name": "QuitBtn", "parent": "MenuPanel", "text": "Quit", "y": -60}
])
TextMeshPro Support
UI Skills auto-detect TextMeshPro:
- With TMP: Uses
- Without TMP: Falls back to legacy
Response includes
field to indicate which was used.
New Element Creation Skills
ui_create_dropdown
Create a Dropdown with options list and full Template/ScrollRect hierarchy.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Dropdown" | Dropdown name |
| string | No | null | Parent object |
| string | No | "Option A,Option B,Option C" | Comma-separated options |
| float | No | 160/30 | Size |
ui_create_scrollview
Create a ScrollRect with Viewport, RectMask2D, and Content.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "ScrollView" | Name |
| string | No | null | Parent object |
| float | No | 300/200 | Size |
| bool | No | false | Enable horizontal scroll |
| bool | No | true | Enable vertical scroll |
| string | No | "Elastic" | Unrestricted/Elastic/Clamped |
ui_create_rawimage
Create a RawImage element (for Texture2D/RenderTexture).
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "RawImage" | Name |
| string | No | null | Parent object |
| string | No | null | Texture asset path |
| float | No | 100 | Size |
ui_create_scrollbar
Create a standalone Scrollbar.
| Parameter | Type | Required | Default | Description |
|---|
| string | No | "Scrollbar" | Name |
| string | No | null | Parent object |
| string | No | "BottomToTop" | LeftToRight/RightToLeft/BottomToTop/TopToBottom |
| float | No | 0 | Initial value (0-1) |
| float | No | 0.2 | Handle size (0-1) |
| int | No | 0 | 0=continuous, >0=discrete |
Property Configuration Skills
ui_set_image
Set Image advanced properties (type, fill, sprite).
| Parameter | Type | Required | Default | Description |
|---|
| string | No* | — | Image element name |
| int | No* | 0 | Instance ID |
| string | No | — | Simple/Sliced/Tiled/Filled |
| string | No | — | Radial360/Radial180/Radial90/Horizontal/Vertical |
| float | No | — | 0-1 fill amount |
| bool | No | — | Fill direction |
| bool | No | — | Preserve aspect ratio |
| string | No | — | Sprite asset path |
ui_add_layout_element
Add/configure LayoutElement constraints.
| Parameter | Type | Required | Default | Description |
|---|
| string | No* | — | Element name |
| float | No | — | Minimum size |
preferredWidth/preferredHeight
| float | No | — | Preferred size |
flexibleWidth/flexibleHeight
| float | No | — | Flexible size (0=fixed, >0=grow) |
| bool | No | — | Ignore layout group |
| int | No | — | Priority (higher overrides) |
ui_add_canvas_group
Add/configure CanvasGroup (alpha, interactable, blocksRaycasts).
| Parameter | Type | Required | Default | Description |
|---|
| string | No* | — | Element name |
| float | No | — | Group alpha (0-1) |
| bool | No | — | Children interactable |
| bool | No | — | Blocks raycasts |
| bool | No | — | Ignore parent groups |
ui_add_mask
Add Mask (stencil-based) or RectMask2D (rect clipping).
| Parameter | Type | Required | Default | Description |
|---|
| string | No* | — | Element name |
| string | No | "RectMask2D" | Mask/RectMask2D |
| bool | No | true | Show mask graphic (Mask only) |
ui_add_outline
Add Shadow or Outline visual effect.
| Parameter | Type | Required | Default | Description |
|---|
| string | No* | — | Element name |
| string | No | "Outline" | Shadow/Outline |
| float | No | 0,0,0,0.5 | Effect color |
| float | No | 1/-1 | Effect offset |
| bool | No | true | Use graphic alpha |
ui_configure_selectable
Configure Selectable properties on Button/Toggle/Slider/etc.
| Parameter | Type | Required | Default | Description |
|---|
| string | No* | — | Element name |
| string | No | — | None/ColorTint/SpriteSwap/Animation |
| bool | No | — | Interactable state |
| string | No | — | None/Horizontal/Vertical/Automatic/Explicit |
| float | No | — | Normal state color |
| float | No | — | Highlighted state color |
| float | No | — | Pressed state color |
| float | No | — | Disabled state color |
| float | No | — | Color multiplier (1-5) |
| float | No | — | Fade duration |
Best Practices
- Always create Canvas first
- Use Panels to organize related elements
- Use meaningful names for scripting access
- Set parent for proper hierarchy
- WorldSpace canvas for 3D UI (health bars, etc.)