Skip to content

Tutorial: Game HUD

What you’ll build: an overlay HUD that sits on top of your game viewport. Health + mana bars top-left, minimap top-right, ability hotbar bottom-center, score text top-center.

┌──────────────────────────────────────────────┐
│ ❤ ▓▓▓▓▓▓▓░░░ SCORE: 1240 ┌────────┐│
│ ✦ ▓▓▓▓▓▓▓▓▓░ │minimap ││
│ └────────┘│
│ │
│ ┌─┬─┬─┬─┬─┬─┬─┬─┐ │
│ │1│2│3│4│Q│W│E│R│ ← hotbar │
│ └─┴─┴─┴─┴─┴─┴─┴─┘ │
└──────────────────────────────────────────────┘

What you’ll learn:

  • Composing multiple Absolute children pinned to different corners
  • Linear vs Radial ProgressBar (HP bar + cooldown rings)
  • The hotbar pattern: Row + Each<T> over slot data
  • When to use .Cover() vs .Absolute() vs .Top() / .Bottom() / .Left() / .Right()

Build it

In the Inspector:

  1. Outer GameObject with AutoLayout, LayoutType = None, Width/Height = Fill. (Set to None because children manage their own positions.)
  2. Add four children, each with Placement = Absolute. Set their anchor edges via the absolute-position fields:
    • HP/Mana — Top: 16, Left: 16
    • Score — Top: 16, anchored center horizontally (use TopBottom unset, custom horizontal constraint Stretch with both offsets equal)
    • Minimap — Top: 16, Right: 16
    • Hotbar — Bottom: 16, anchored center horizontally

Inside each, add the relevant child layout (Column for HP/Mana, single Image for Minimap, Row for Hotbar).

The code path is shorter and easier to maintain when you have many absolute panels — Inspector wiring of 4+ anchored elements is fiddly.

Try this next

Damage flash. When HP drops, briefly flash the HP bar’s track color via Tweening. Wire it to your damage event.

Ability press feedback. On key press, scale the corresponding slot down to 0.92 then back to 1.0 over 100ms. Nice tactile feedback.

Buff/debuff icons. Add a Wrap row above the hotbar with active status icons (poison, shield, haste). Set the container to Wrap() and a WrapGap; the icons reflow when the row narrows.

Mini-radar dots. Inside the minimap, render absolute-positioned colored dots for nearby entities. Update positions in Update() based on world positions projected to minimap space.

Portrait + name. Add a circular avatar to the top-left vitals panel — set WidthAspect(1f) plus a circular sprite, and Center() it inside its slot.

See also

Docs for AutoLayout PRO v1.0.0 Changelog