Add a HUD element¶
Designer · 20 min · No code
Result: your own widget (here, an in-game clock) on the HUD in play, placed in one of the HUD's
named slots, without editing W_XenoCore_HUDLayout or any other XenoCore asset.
Before you start¶
- UI shell and HUD: layers, HUD plates, and why a HUD element hides by opacity.
- Glossary: Experience, Game Feature plugin.
How it works¶
The HUD layout, UserInterface/HUD/W_XenoCore_HUDLayout, carries five empty extension points:
Lyra's UIExtensionPointWidget, each named by a gameplay tag. Lyra's Add Widgets action puts a
widget into the point whose tag matches. The points are empty and do not take clicks until
something is added.
| Slot tag | Where on screen | How several widgets stack |
|---|---|---|
HUD.Slot.XenoCore.TopCenter |
Top centre, 48 px down | In a column, centred |
HUD.Slot.XenoCore.TopRight |
Top right, 48 px in, 330 px down (below the minimap and its prompt) | In a column, right-aligned |
HUD.Slot.XenoCore.Center |
Screen centre | On top of each other |
HUD.Slot.XenoCore.BottomCenter |
Bottom centre, 48 px up | In a column, centred |
HUD.Slot.XenoCore.FullScreen |
Fills the screen, behind the rest of the HUD | On top of each other |
All five tags come with XenoCore, so they appear in every tag picker.
Steps¶
1. Make the widget¶
- In
Content/MyGame/UI, right-click and choose User Interface › Widget Blueprint, parent User Widget. Name itW_MyGame_Clock. - Lay it out small: the slot sizes itself to your widget (except FullScreen).
- Set anything that must not catch clicks to Hit Test Invisible.
For a widget that fades in and out
Parent it to XenoCoreHudPlateBase instead. It then has Set Shown (fade in or out
without removing it), Set Shown Immediate, Set Show Delay and, from its own graph,
Begin Hidden and Skip Intro, all callable from Blueprint. Never hide a HUD element by
collapsing it: a collapsed widget stops ticking and cannot notice when to come back.
2. Add it with an action set¶
Keep the addition in your own asset, so a template update cannot remove it.
- In
Content/MyGame/Experiences, right-click and choose Data › Data Asset, classLyraExperienceActionSet. Name itLAS_MyGame_HUD. - Open it. Under Actions to Perform, add an entry and choose Add Widgets.
- Under Widgets, add a row:
- Widget Class:
W_MyGame_Clock - Slot ID:
HUD.Slot.XenoCore.TopCenter
- Widget Class:
- Leave Layout empty. That list is for whole HUD layouts, such as the one
Experiences/LAS_XenoCore_HUDadds. - Save.
3. Use the action set in your experience¶
An Experience decides what a map loads, HUD included.
- In Plugins › XenoCore Content › Experiences, duplicate
B_XenoCore_ExperienceintoContent/MyGame/Experiencesif you have not already, and point your maps' World Settings › Default Gameplay Experience at the copy. - Open the copy, click Class Defaults, and add
LAS_MyGame_HUDto Action Sets, besideLAS_XenoCore_HUD. - Save.
From your own Game Feature plugin instead
If your content lives in its own Game Feature plugin, you can put the same Add Widgets action in that plugin's Game Feature Data (Actions). It applies whenever that feature is active.
Test it¶
- Open a map that uses your experience and press Play.
- The clock appears at the top centre when the HUD appears.
- Open the menu: the HUD, clock included, stays under the menu; close it and the clock is still there.
- Stop and remove the row: nothing else on the HUD changed.
If it doesn't work¶
Fails silently: the widget never appears
Nothing is logged when a widget goes to a slot tag no extension point carries. Check, in order:
the Slot ID is one of the five HUD.Slot.XenoCore.* tags exactly; the action set is in the
Action Sets of the experience the map actually uses (Window › World Settings ›
Default Gameplay Experience); Widget Class is set. An ExperienceOverride line in your
project's Saved/Config files also outranks World Settings; delete it if you find one.
The widget appears behind everything
FullScreen is deliberately behind the rest of the HUD. Use Center for an overlay that must be on top.
The widget blocks clicks on a menu
It cannot: the HUD is on the game layer, under the menus. If it blocks clicks in play, a child widget is Visible; set it to Hit Test Invisible.
Going further¶
- UI shell and HUD
- Add an input action with a prompt: put its glyph on the HUD through one of these slots.
- Restyle the menus: the XenoCore UI settings replace whole HUD widgets such as the interact prompt and the battle notifications.