Skills

Responsive UI

Use when handling multiple resolutions, stretch modes, aspect ratios, DPI scaling, and...

Install

npx skills add jame581/GodotPrompter --skill responsive-ui -g -a claude-code -y
Category
Engineering
Updated
3d ago
License
MIT
Context cost
Mediumabout 2,426 tokens
Runs scripts
No, instructions only

What it does

Use when handling multiple resolutions, stretch modes, aspect ratios, DPI scaling, and mobile/desktop adaptation

Responsive UI in Godot 4.3+

All examples target Godot 4.3+ with no deprecated APIs. GDScript is shown first, then C#.

Related skills: godot-ui for Control node layout and themes, export-pipeline for platform-specific export settings, godot-project-setup for initial project resolution settings, input-handling for touch vs desktop input adaptation, localization for layout adjustments per locale, mobile-development for safe-area and notch handling.


1. Project Settings for Resolution

Configure base resolution and stretch behaviour in Project > Project Settings > Display > Window.

Key settings and their keys in the [display] section of project.godot:

Settingproject.godot keyRecommended value
Viewport widthwindow/size/viewport_width1920 (or your base design width)
Viewport heightwindow/size/viewport_height1080 (or your base design height)
Stretch modewindow/stretch/modecanvas_items (most games)
Stretch aspectwindow/stretch/aspectexpand (fill screen) or keep (letterbox)
Scale factorwindow/stretch/scale1
Scale modewindow/stretch/scale_modefractional; integer for pixel art

Godot 4.7+: Projects newly created in Godot 4.7 already default display/window/stretch/mode to canvas_items and display/window/stretch/aspect to expand (previously disabled / keep), the recommendations above are now the out-of-the-box values. Projects created on older versions are unchanged (the property default is still disabled), so set both explicitly when upgrading. See the 4.7 migration guide.

The engine reads these settings once at startup; changing them with ProjectSettings.set_setting() later has no effect. At runtime, set the matching Window properties instead:

GDScript:

Read the whole SKILL.md on GitHub

More in Engineering