Game dev
Saved & recent

Anchors

Related terms: UI scaling, canvas scaler, responsive UI, safe area, automatic layout

UI has to fit many screen shapes. Each element is anchored to a corner, an edge or the center of its parent, and keeps its distance from that anchor. A health bar anchored top-left stays top-left on a phone and on an ultrawide monitor.

UI scaling also grows or shrinks the whole interface with resolution. The safe area keeps it clear of notches and rounded corners.

Further reading
Godot Engine: Size and anchors
landscape top-left anchor center anchor portrait safe area
The health bar and minimap keep their offsets from the top corners of the dashed safe area. The reticle stays centered inside it.

View in the full Game dev collection