If you’re building a UI-heavy game, Godot’s default stretch modes can only take you so far. Uniform scaling often leads to blurry text on lower resolutions or huge amount of wasted screen real estate on larger monitors.
In web dev, Tailwind solved this years ago with utility breakpoints (md:flex-row). I decided to bring that exact philosophy into Godot.
How it works:
-
Global Breakpoint Schema: An Autoload (
UIRules) listens to the root viewport’ssize_changedsignal, accounts for OS scale factors, and evaluates the window width against a defined set of breakpoints (SM: 640,MD: 768,LG: 1024, etc.). -
Signal-Driven State: Instead of polling window sizes every frame or spamming continuous resize math,
UIRulesonly emits abreakpoint_changedsignal when an actual threshold is crossed. -
Modular Subscriptions: A base
UIUpdaternode automatically handles the signal connection. Any component script can just extendUIUpdaterand override_update_gui_bp(new_breakpoint)to adapt its layout.
I wrote a detailed breakdown with full code snippets, notes, and visual examples on GO-DOiT Right:
