Game UI

Safe areas

A safe area is the part of a screen where text and controls are certain to be seen and reached. A television may cut off its outer edge. A phone has a notch or an island at one end and a home indicator along the bottom. In Nox a frame carries its safe area as four numbers, and shows it as tinted bands along its edges while you design.

A 1080p screen with its two bands: action-safe outside, title-safe inside
A 1080p screen with its two bands: action-safe outside, title-safe inside

Title-safe and action-safe#

Television and console screens use two areas, one inside the other.

AreaHow far inWhat keeps inside it
Title-safe5% of each sideText, numbers, button hints, anything the player must read
Action-safe3.5% of each sideEverything else that matters: icons, bars, the edge of a panel

For the presets Nox ships, to the nearest pixel:

PresetSizeTitle-safe: sides, top and bottomAction-safe
1080p1920 × 108096, 5467, 38
1440p2560 × 1440128, 7290, 50
4:31024 × 76851, 3836, 27

Backdrop art runs to the very edge of the frame. Only the interface keeps in.

Phone insets#

A phone held sideways keeps clear the same distance at both ends, because the player may turn it either way, and a strip along the bottom for the home indicator.

A phone held sideways: 141 pixels kept clear at each end, 63 below
A phone held sideways: 141 pixels kept clear at each end, 63 below
PresetIn pixelsThe same in points
2532×1170141 at each end, 63 below, 0 above47 and 21, at 3 pixels to a point
2796×1290177 at each end, 63 below, 0 above59 and 21
iPhone (390 × 844, upright)47 above, 34 belowIn points already
iPad (820 × 1180, upright)24 above, 20 belowIn points already

These follow Apple's published figures for those screens. For another device, type its own insets.

Set a safe area#

By hand
  1. Press F and choose a screen in the strip, such as 1080p. The frame is made with its safe area.
  2. For any other frame, select it and press the plus beside Game UI in the inspector.
  3. Type Safe T, Safe B, Safe L and Safe R: how far in from the top, bottom, left and right.
  4. Choose View › Safe Areas to show or hide the bands. The Safe areas chip at the right of the frame tool's strip does the same.
The Safe fields of a 1080p frame, in the Game UI section
The Safe fields of a 1080p frame, in the Game UI section

The four fields set the frame's first area. On a television preset that is the title-safe one. The bands are guides: they are never drawn in an export.

With an agent

Name the screen and the convention. The property is safe_area: top, right, bottom, left. Four more numbers may follow for a second, wider area shown with the first.

Give the HUD frame a television's safe areas: title-safe 5% in, action-safe 3.5% in.

The agent calls update_nodes with:

{
  "changes": [
    { "id": "3:2", "safe_area": [54, 96, 54, 96, 38, 67, 38, 67] }
  ]
}

For a phone held sideways, one area is enough: "safe_area": [0, 141, 63, 141]. null takes it away.

Note

The order differs between the two places. The inspector reads T, B, then L, R. The safe_area property reads top, right, bottom, left, clockwise from the top.

Layouts that keep inside#

The bands show the limit. Keeping to it is the layout's job. Three habits make it hold.

Place each cluster on the inset. On a 1080p frame, the top-left cluster starts at x 96, y 54. The top-right cluster ends at x 1824, which is 1920 less 96. The bottom row ends at y 1026, which is 1080 less 54.

Pin each cluster to its own corner. A cluster pinned Right and Top keeps its 96 and 54 when the frame becomes wider or taller. Select the cluster and set Pins in the inspector: H to Left, Right, Left and right, Center or Scale, and V to Top, Bottom, Top and bottom, Center or Scale.

Give text the tighter area. Hold text and numbers to the title-safe area, and let a decorative frame around them reach into the action-safe band.

Through the tools the pin is one property. This call to update_nodes holds a counter to the top right:

{
  "changes": [
    { "id": "3:14", "pin": { "horizontal": "right", "vertical": "top" } }
  ]
}

Pins keep a distance, not a percentage. A cluster 96 from the side of a 1920 frame is still 96 from the side at 2560 wide, where the title-safe inset is 128. When you make the frame a different size class, set its safe_area for that size and move the clusters onto the new inset.

Before you call it done#

  • Show the bands and look at each corner. Nothing the player reads should sit on a band.
  • Ask an agent to measure. inspect returns in_parent: how far a node is from each edge of its frame, in numbers you can hold against the inset.
  • Preview the frame at another size without changing it. An agent calls render_preview with a width and height, and the frame is drawn as its pins would lay it out.
  • On a phone, check both ends. The notch may be at either.