godot-ui

Installation
SKILL.md

UI (4.7)

Build UI as scenes (ui/hud/hud.tscn) made in the editor, or with ../godot-core/scripts/scene_edit.py. Scripts only fill in data and react. Input actions and gamepads are in godot-input.

Layout fundamentals

  • Containers do the layout. Use VBoxContainer/HBoxContainer, GridContainer, MarginContainer (padding), PanelContainer (background), CenterContainer, ScrollContainer, FlowContainer (wrapping tags/items), AspectRatioContainer, TabContainer, FoldableContainer (4.5+) and SplitContainer. Children of containers ignore their own anchors and position.
  • Size flags decide each child's share: size_flags_horizontal = SIZE_EXPAND_FILL (+ size_flags_stretch_ratio), SIZE_SHRINK_CENTER, and so on. custom_minimum_size sets a floor.
  • The root of a UI scene is a Control with set_anchors_and_offsets_preset(PRESET_FULL_RECT). HUD corners use anchor presets (PRESET_TOP_LEFT …) plus a MarginContainer.
  • To animate or juice controls inside containers, use the 4.7 offset_transform_* properties (offset_transform_enabled, _position, _rotation, _scale, _pivot_ratio, _visual_only). Containers don't overwrite them, unlike position/scale. pivot_offset_ratio (4.6+) sets a pivot as a fraction of size, so (0.5, 0.5) is the center.
  • mouse_filter: STOP (default for most), PASS, or IGNORE for decorative overlays that would otherwise block clicks to the game. Use mouse_behavior_recursive/focus_behavior_recursive (4.5+) to disable a whole subtree.

Multi-resolution and devices

  • New 4.7 projects use stretch mode canvas_items + aspect expand. Design at 1920×1080 (or 1280×720) and anchor to edges so wider and taller screens just reveal more space. Pixel-art games use viewport + integer scaling (see godot-2d).
  • Mobile safe area (notches): read DisplayServer.get_display_safe_area() and pad the root MarginContainer (see the reference).
  • Text size: minimum ~24 px at 1080p for TV/console legibility, and touch targets of at least ~48 px at the base resolution.
  • Window.content_scale_factor gives a user-facing "UI scale" option.
Installs
13
GitHub Stars
54
First Seen
9 days ago