Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when building user interfaces — Control nodes, themes, anchors, containers, and layout patterns
.claude/skills/jame581-godot-ui/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 89% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 88% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 36% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 108% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 22% | 0% |
All examples target Godot 4.3+ with no deprecated APIs; GDScript first, then C#.
> Related skills: responsive-ui for multi-resolution scaling, hud-system for in-game HUD patterns, dialogue-system for dialogue UI presentation, tween-animation for UI transition and animation effects.
Control is the base class for all UI nodes — it lives in a separate scene-tree branch from Node2D/Node3D with a fundamentally different layout model.
| Feature | Node2D | Control | |---|---|---| | Position model | World-space position (pixels from parent) | Anchor + offset relative to parent rect | | Size | No intrinsic size | Has size, minimum_size, custom_minimum_size | | Theme | None | Inherits and overrides Theme resources | | Focus | Not applicable | Built-in focus system (focus_mode, grab_focus()) | | Mouse events | Manual via _input | gui_input, mouse_entered, mouse_exited | | Layout helpers | None | Container subclasses auto-arrange children |
Every UI widget (Button, Label, LineEdit, etc.) extends Control. Key properties defined on Control itself:
anchor_left, anchor_top, anchor_right, anchor_bottom — fractional values (0.0–1.0) relative to the parent rectoffset_left, offset_top, offset_right, offset_bottom — pixel offsets applied after the anchor resolvessize_flags_horizontal, size_flags_vertical — how the node participates in Container layouttheme — a Theme resource; if null, walks up the tree to the nearest ancestor with onefocus_mode — whether the node can receive keyboard/gamepad focusPlace UI nodes inside a CanvasLayer (or directly under the scene root's built-in canvas) so they render on top of the 3D/2D world, unaffected by Camera transforms.
> ⚠️ Changed in Godot 4.7: Control.accessibility_live changed type from DisplayServer.AccessibilityLiveMode to AccessibilityServer.AccessibilityLiveMode (LIVE_OFF = 0 default, LIVE_POLITE, LIVE_ASSERTIVE) — accessibility enums/APIs moved to the new AccessibilityServer singleton. GDScript-compatible; breaks C# binary/source compatibility (rebuild against the new enum). See the 4.7 migration guide.
| Container | Purpose | When to Use | |---|---|---| | VBoxContainer | Stacks children vertically | Lists, option rows, vertical menus | | HBoxContainer | Stacks children horizontally | Toolbars, stat rows, horizontal nav | | GridContainer | Arranges children in a fixed-column grid | Inventory grids, key-binding tables | | MarginContainer | Adds padding around a single child | Wrapping any node to give it breathing room | | PanelContainer | Draws a StyleBox background, then lays out children | Card UI, dialog boxes, HUD panels | | ScrollContainer | Makes its single child scrollable; clips overflow | Long lists, logs, scrollable settings | | TabContainer | Stacks children as named tabs; shows one at a time | Settings screens, multi-section panels |
Sizing tips:
size_flags_horizontal = SIZE_EXPAND_FILL on children that should fill available space.custom_minimum_size to prevent a child from collapsing to zero.MarginContainer reads margin from the theme property margin_*; override at runtime with add_theme_constant_override("margin_left", 16).> Godot 4.7+: custom_maximum_size (Vector2(-1, -1)) caps size per axis, prioritized over custom_minimum_size; propagate_maximum_size (default false) makes a parent's maximum constrain its Control children; _get_maximum_size() computes maximums from code.
> ⚠️ Changed in Godot 4.7: TabContainer.all_tabs_in_front is deprecated — it does nothing now, since tabs are always in front. Remove code that sets it. See GH-118623.
An anchor is a point on the parent rect expressed as a fraction (0 = top/left edge, 1 = bottom/right edge). Godot resolves the final pixel position of each edge as:
final_left = parent_width * anchor_left + offset_left
final_top = parent_height * anchor_top + offset_top
final_right = parent_width * anchor_right + offset_right
final_bottom = parent_height * anchor_bottom + offset_bottomThe editor exposes built-in presets:
| Preset | Anchor values | Use case | |---|---|---| | Full Rect | L=0, T=0, R=1, B=1 | Overlay / fill parent — most common for root UI | | Center | L=0.5, T=0.5, R=0.5, B=0.5 | Fixed-size widget centred in parent | | Top Left | L=0, T=0, R=0, B=0 | Fixed-size widget pinned to top-left corner | | Top Right | L=1, T=0, R=1, B=0 | Fixed-size widget pinned to top-right corner | | Bottom Center | L=0.5, T=1, R=0.5, B=1 | HUD element anchored to bottom centre |
Anchors resolve as parent_size * anchor + offset per edge, so setting them by hand means setting eight properties. set_anchors_and_offsets_preset(Control.PRESET_*) does it in one call — use that, then adjust offset_* for margins (negative on right/bottom).
The anchor-vs-offset rule (keep offsets at 0 and let anchors do the work) plus full GDScript + C# examples — full-rect fill, top-right HUD with 16 px margins, and a custom half-screen side panel: references/anchors-in-code.md
A Theme resource centralizes fonts, colors, and StyleBoxes. Apply at the root and let inheritance do the work; use theme_override_* only for one-off tweaks. StyleBoxFlat covers most flat-design needs (bg_color, border_color, corner_radius, border_width); StyleBoxTexture for textures.
> See references/theme-system.md for the full Theme resource creation walk-through, StyleBoxFlat properties, font overrides, theme inheritance rules, and per-node theme_override_* methods.
> Godot 4.7+: GradientTexture2D's Fill enum gains FILL_CONIC — colors interpolated in a cone (angular) pattern; radial progress/cooldown indicators without a shader (C#: FillEnum.Conic).
Focus modes (FOCUS_NONE, FOCUS_CLICK, FOCUS_ALL) gate keyboard/gamepad navigation. Wire chains with focus_neighbor_top / _bottom / _left / _right, or rely on automatic spatial detection. Call grab_focus() on the first interactive element when a menu opens.
> See references/focus-and-navigation.md for focus mode details, focus_neighbor chain examples, gamepad/keyboard input handling, and grab_focus patterns.
Three canonical scenes: a main menu (centered VBoxContainer with title + button list), a settings screen with tabs (TabContainer + child panels per category), and a pause menu overlay (full-rect ColorRect background + centered options panel, paused via get_tree().paused = true).
> See references/ui-patterns.md for the full scene-tree fragments and GDScript wiring for each pattern.
> Godot 4.7+: offset_transform_* — visual-only UI-juice transform (shake/pulse) that never re-triggers container layout; _get_cursor_shape(at_position) — per-position cursor shapes; PopupMenu search bar (search_bar_enabled, fuzzy by default) plus set_item_index() for reordering; TextureRect STRETCH_TILE now tiles AtlasTextures (only non-zero margin unsupported). Code: references/ui-patterns.md.
> ⚠️ Changed in Godot 4.7: RichTextLabel.add_image() / update_image() sizing was reworked — width/height are now float; width_in_percent/height_in_percent bools become width_unit/height_unit, taking the new ImageUnit enum (IMAGE_UNIT_PIXEL, IMAGE_UNIT_PERCENT, IMAGE_UNIT_EM — em scales with font size). ImageUpdateMask.UPDATE_WIDTH_IN_PERCENT is renamed UPDATE_WIDTH_UNIT, breaking GDScript using the old name. See the 4.7 migration guide.
Button.pressed for clicks, Control.gui_input for raw events on a node, Control.mouse_entered / mouse_exited for hover. Connect in _ready() or via the Inspector's Node panel.
> See references/signals.md for the complete signal catalog and signal-driven UI update patterns.
FoldableContainer is a built-in accordion Container added in Godot 4.5 — a toggle header plus collapsible children, replacing the old boilerplate of wiring a Button to show/hide a VBoxContainer. Set title, set folded for the initial state, add children normally, and listen to folding_changed(is_folded).
Full GDScript + C# construction, the key-properties table, and the toggle signal: references/foldable-container.md
Godot 4.5 lets Label and RichTextLabel layer multiple text effects simultaneously — e.g., stacking two outline effects at different widths/colors, or combining a shadow with a glow. Previously, multiple outline layers required duplicating and manually layering Label nodes.
gdscript# Configure via Theme Overrides → Constants in the inspector, or add_theme_* overrides at runtime. func apply_stacked_outlines(label: Label) -> void: # Outer outline — wide, dark label.add_theme_constant_override("outline_size", 6) label.add_theme_color_override("font_outline_color", Color(0.0, 0.0, 0.0, 0.9)) # Shadow (second layered effect) label.add_theme_constant_override("shadow_offset_x", 2) label.add_theme_constant_override("shadow_offset_y", 2) label.add_theme_color_override("font_shadow_color", Color(0.0, 0.0, 0.0, 0.5))
csharppublic void ApplyStackedOutlines(Label label) { // Outer outline — wide, dark label.AddThemeConstantOverride("outline_size", 6); label.AddThemeColorOverride("font_outline_color", new Color(0f, 0f, 0f, 0.9f)); // Shadow (second layered effect) label.AddThemeConstantOverride("shadow_offset_x", 2); label.AddThemeConstantOverride("shadow_offset_y", 2); label.AddThemeColorOverride("font_shadow_color", new Color(0f, 0f, 0f, 0.5f)); }
For RichTextLabel, stacked effects can also be applied via BBCode combined with theme overrides:
gdscript# Multiple outline-style effects via BBCode + theme $RichTextLabel.text = "[outline size=4 color=#000000]Level Up![/outline]" # Additional layers via theme overrides, as above.
> Editor workflow: Configure stacked effects via Theme Editor → Label → Constants, or add multiple FontFile-style outline passes in the Font resource. The runtime API (add_theme_*_override) above covers dynamic scenarios.
Control has anchor preset Full Rect (or appropriate preset for the layout)Button, LineEdit, Slider) have focus_mode = FOCUS_ALLLabel, TextureRect) have focus_mode = FOCUS_NONEgrab_focus() called on the first interactive widget in _ready() for each screenControl has process_mode = PROCESS_MODE_ALWAYSTheme resource assigned at the screen root — not duplicated on every childStyleBoxFlat used instead of image assets for simple solid-colour panelsadd_theme_*_override() used for per-node overrides rather than assigning a whole new ThemeVBoxContainer, HBoxContainer, etc.) used for layout instead of manual position valuescustom_minimum_size set on widgets that must not collapse to zerolinear_to_db / db_to_linear — not raw linear values mapped to audio bus_ready() (or via the editor); no polling of UI state in _processTabContainer matches logical reading / navigation orderFoldableContainer instead of manual Button + VBoxContainer wiring (Godot 4.5+)Label/RichTextLabel use stacked theme overrides instead of duplicated nodes (Godot 4.5+)| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→pass | 16,545 | 12,086 | -27% | 1 | 1 | 0% | 3,090 | 5,837 | +89% | 0 | 0 | — |
case-01 | pass→fail | 14,005 | 10,816 | -23% | 1 | 1 | 0% | 2,652 | 5,438 | +105% | 0 | 0 | — |
case-03 | fail→pass | 12,433 | 3,213 | -74% | 1 | 1 | 0% | 2,193 | 4,115 | +88% | 0 | 0 | — |
case-04 | pass→pass | 10,260 | 2,706 | -74% | 1 | 1 | 0% | 1,707 | 4,039 | +137% | 0 | 0 | — |
case-05 | fail→pass | 19,774 | 4,219 | -79% | 1 | 1 | 0% | 3,088 | 4,212 | +36% | 0 | 0 | — |
case-06 | fail→pass | 14,049 | 6,082 | -57% | 1 | 1 | 0% | 2,252 | 4,685 | +108% | 0 | 0 | — |
case-23 | pass→fail | 10,578 | 8,626 | -18% | 1 | 1 | 0% | 1,967 | 5,134 | +161% | 0 | 0 | — |
case-07 | pass→pass | 10,675 | 7,428 | -30% | 1 | 1 | 0% | 1,886 | 4,811 | +155% | 0 | 0 | — |
case-08 | pass→pass | 4,126 | 5,387 | +31% | 1 | 1 | 0% | 701 | 4,368 | +523% | 0 | 0 | — |
case-09 | pass→pass | 11,713 | 10,194 | -13% | 1 | 1 | 0% | 1,998 | 5,204 | +160% | 0 | 0 | — |
case-10 | pass→pass | 11,957 | 8,556 | -28% | 1 | 1 | 0% | 2,257 | 5,158 | +129% | 0 | 0 | — |
case-11 | fail→pass | 24,540 | 7,493 | -69% | 1 | 1 | 0% | 4,071 | 4,985 | +22% | 0 | 0 | — |
case-12 | fail→pass | 13,981 | 3,217 | -77% | 1 | 1 | 0% | 2,196 | 4,033 | +84% | 0 | 0 | — |
case-13 | fail→pass | 9,321 | 4,833 | -48% | 1 | 1 | 0% | 1,655 | 4,387 | +165% | 0 | 0 | — |
case-14 | pass→pass | 12,891 | 9,980 | -23% | 1 | 1 | 0% | 2,008 | 5,301 | +164% | 0 | 0 | — |
case-15 | pass→pass | 10,496 | 9,131 | -13% | 1 | 1 | 0% | 1,712 | 4,962 | +190% | 0 | 0 | — |
case-16 | pass→pass | 3,584 | 3,160 | -12% | 1 | 1 | 0% | 657 | 4,070 | +519% | 0 | 0 | — |
case-17 | pass→pass | 11,194 | 7,763 | -31% | 1 | 1 | 0% | 1,695 | 4,821 | +184% | 0 | 0 | — |
case-18 | pass→pass | 7,233 | 6,631 | -8% | 1 | 1 | 0% | 1,128 | 4,680 | +315% | 0 | 0 | — |
case-19 | pass→pass | 11,448 | 6,673 | -42% | 1 | 1 | 0% | 1,913 | 4,624 | +142% | 0 | 0 | — |
case-20 | fail→pass | 15,472 | 5,642 | -64% | 1 | 1 | 0% | 2,341 | 4,602 | +97% | 0 | 0 | — |
case-21 | pass→pass | 9,996 | 7,219 | -28% | 1 | 1 | 0% | 1,595 | 4,821 | +202% | 0 | 0 | — |
case-22 | pass→pass | 11,491 | 9,323 | -19% | 1 | 1 | 0% | 2,055 | 5,231 | +155% | 0 | 0 | — |
case-24 | pass→pass | 15,073 | 10,496 | -30% | 1 | 1 | 0% | 2,364 | 5,212 | +120% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +25 percentage points is the difference between those two pass rates over the 24 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.