38 · UI/UX · 2D and 3D

UI scaling and anchors

A HUD that fits every screen size.

A HUD placed at fixed pixel positions looks perfect on your monitor and falls off the edge of a phone or an ultrawide screen. Anchoring each element to a corner or edge, and scaling the whole UI from a reference resolution, keeps health bars, minimaps and buttons where players expect them.

←↑↓→ or WASD moveZ screen size · N anchors on/offD-pad to play

Try this: Collect coins, then switch the screen to Phone. With fixed pixels the coin counter and Jump button fall off the edge. Turn on Anchored and they stick to the corners.

Fixed pixels look fine on the screen they were made for. Switch to Phone.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Make the HUD resolution-independent: anchor each element to its corner or edge with an offset, scale everything from a 1920x1080 reference matching width or height, keep inside the safe area, and fade layout changes over 0.2 s so rotating a phone never leaves elements offscreen.

45 words · one sentence to paste as is

Where it's used

Common mistakes

Positioning by absolute pixels from the top-left, scaling only by width so tall phones crop the HUD, ignoring the safe area so buttons hide under the notch, and tiny text and buttons on high-DPI phones.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.