Home › Systems › AFS_UI_Menu
System

AFS_UI_Menu

The main menu, opened with a key in the pawn UI on every platform, and a desktop sidebar, both built from page data assets, plus the settings pages and setting item widgets.

What it gives you

  • One menu for VR, desktop and mobile, toggled by the menu button, Escape or Tab
  • A sidebar that stays on the desktop HUD
  • Pages defined as data assets
  • A ready-made settings page

Requires

AFA_Colors AFL_Libraries AFM_Abilities AFM_Settings AFM_State AFS_Core_Pawn AFS_UI AFS_UI_Notifications AFS_UI_Pawn AFS_UX_Grip AFS_UX_Locomotion AFS_UX_Teleporter

Required by

AF_Examples

22 assets20 API members

Description

Two widgets show pages: WBP_Menu, the full menu, and WBP_Sidebar, a button bar that stays on the desktop HUD. Pages are PDA_WidgetPage data assets naming a widget class and a button label. The menu reads them from the pawn's BPC_Pawn_Menu, the sidebar from its BPC_Pawn_Sidebar.

BPC_Pawn_Menu is a pawn ability. For the local player it adds IMC_Menu, and its IA_Menu (the left menu button on Quest and Vive, Escape, Tab, the gamepad Start button) calls Toggle Menu, which opens or closes WBP_Menu in the pawn UI at DA_PawnUIPosition_Menu: in front of the player in VR, on the HUD on desktop and mobile. On desktop the menu takes the mouse and keyboard (UI Only) and closes itself on the same keys. The VR showroom hands also show WBP_Menu on the palm.

Because pages are data, adding one is a data change, and a project can reorder or remove pages per pawn without touching either widget.

Setup

  1. Add BPC_Pawn_Menu to your pawn, together with BPC_PawnAbility_PawnUI (and on desktop and mobile BPC_PawnAbility_HUD), which shows the menu.
  2. Populate Pages with PDA_WidgetPage assets. The settings pages (DA_WidgetPage_Settings_Desktop_Graphics, _Sound, _Gameplay, and the _VR_ and _Mobile_ sets) and DA_WidgetPage_Debug are ready to use.
Menu pages listed on the pawn component
AFS_UI_Menu_details.pngMenu pages listed on the pawn component
Menu pages listed on the pawn component

Usage

Adding a page

See Add a menu page.

Opening the menu

The menu key toggles it. To open it from your own button, call Toggle Menu on the pawn's BPC_Pawn_Menu. A touch device has no menu key, so a mobile pawn needs such a button.

A sidebar on the desktop HUD

Add BPC_Pawn_Sidebar to the pawn, fill its Pages, and list WBP_Sidebar in the HUD ability's Initial Widgets, as the desktop showroom pawn does.

Different menus per pawn

The page lists live on the pawn, so a VR pawn and a desktop pawn can offer different pages.

The VR menu
AFS_UI_Menu_vr.pngThe VR menu
The VR menu

Key properties

PropertyWhen to change
PagesOn BPC_Pawn_Menu (menu) or BPC_Pawn_Sidebar (sidebar), to change which pages appear and in what order
Input MenuOn BPC_Pawn_Menu, to open the menu with other keys: assign your own copy of IMC_Menu
Position MenuOn BPC_Pawn_Menu, to show the menu at another pawn UI position

Extending

Derive your page widgets from WBP_Base. To restyle the menu or the sidebar, derive from WBP_Menu or WBP_Sidebar.

Example map

The menu in Map_Examples_Lobby is the shipped menu with navigation, settings and debug pages.

Troubleshooting

A page does not appear. Its data asset is not in the Pages list of the right component: the menu reads BPC_Pawn_Menu, the sidebar BPC_Pawn_Sidebar.

The sidebar is empty. The pawn has no BPC_Pawn_Sidebar, or its Pages are empty.

The menu key does nothing. The pawn lacks BPC_PawnAbility_PawnUI, or another context with a higher priority takes the key.

API reference

Every blueprint asset in this module. Expand an asset to see its members.

Components

BPC_Pawn_Menu5 members
extends BPC_PawnAbility

Pawn ability that opens and closes the in-game menu and lists its pages. For the local player it adds Input Menu, and its menu key (IA_Menu: the left menu button on Quest and Vive, Escape, Tab, the gamepad Start button) calls Toggle Menu, which shows WBP_Menu in the pawn UI at Position Menu. WBP_Menu builds its navigation from Pages, so one menu widget serves every pawn and the pages are configured per pawn. Needs BPC_PawnAbility_PawnUI on the same pawn.

KindNameSignatureDescription
varPagesContentST_Menu_Page[]Top level entries of the pawn's menu, each holding the button that opens it and the widget pages shown once it is open. The menu widgets look the array up by index the moment a menu button is selected, so an entry whose page list is empty opens an empty subpage.
varInput MenuInputInputMappingContextMapping context added while the ability is active for the local player, carrying IA_Menu. Assign a copy of IMC_Menu to open the menu with other keys; WBP_Menu closes itself on whatever keys this context maps to IA_Menu.
varPosition MenuStylePDA_PawnUIPositionPawn UI position the menu opens at. Its HUD frame decides the desktop behaviour; the default centres the menu with a background and switches to UI Only, so the game gets no input until the menu closes.
varReferencesContentStruct_ReferencesReferences handed to WBP_Menu when Toggle Menu opens it, for menus whose pages need to reach other objects. Empty by default.
fnToggleMenu()Opens WBP_Menu in the pawn UI at Position Menu, or closes it when it is open. On desktop the opened menu gets keyboard focus, so it can close itself on the menu keys while the game is in UI Only. Bound to IA_Menu; call it from your own button to open the menu on touch devices.
BPC_Pawn_Sidebar1 members
extends BPC_PawnAbility

Pawn ability listing the entries of the desktop sidebar (WBP_Sidebar). Add it to a pawn that shows the sidebar on its HUD and fill in Pages; the sidebar reads them from the pawn, the same way WBP_Menu reads BPC_Pawn_Menu. Without it the sidebar is empty.

KindNameSignatureDescription
varPagesContentST_Menu_Page[]Entries of the sidebar, each holding the button and the widget pages shown once it is selected. The sidebar looks the array up by index when a button is selected, so an entry whose page list is empty opens an empty subpage.

Widgets

WBP_Menu3 members
extends WBP_Base

In-game menu: logo, a vertical pagination list and a quit button in an expanding scaffold, with the chosen entry building a subpage next to it. Pages come from the player pawn's BPC_Pawn_Menu, and quitting asks for confirmation in an overlay first. Opened by the menu key through BPC_Pawn_Menu's Toggle Menu in the pawn UI on every platform, and shown on the palm by the VR showroom hands. On desktop it holds keyboard focus and closes itself on the menu keys.

KindNameSignatureDescription
fnOnKeyDownInput(MyGeometry: Geometry, InKeyEvent: KeyEvent) → EventReplyCloses the menu when a key that IA_Menu is mapped to is pressed while the menu has keyboard focus, which is how it closes on desktop, where the game gets no input in UI Only. The keys are asked from Enhanced Input, so they follow the pawn's Input Menu context. Every other key is left unhandled.
eventWidgetElement_PostInitiateStyle()Called once the whole widget tree has been initiated and themed. Left empty on the wrist menu, so its tab column keeps the tabs set in the designer; the entries in Pages on the pawn's menu component are only read once a tab is selected.
eventConfirmationPressed_Event(Confirm: bool)Handles the answer coming back from the quit confirmation overlay. Quits the game to the platform when Confirm is true; a refusal closes the overlay and leaves the menu as it was.
WBP_Sidebar1 members
extends WBP_Base

Desktop sidebar: a vertical button bar in a side scaffold that stays on the HUD, with the chosen entry building a subpage beside it. The entries come from the pawn's BPC_Pawn_Sidebar, so configure them there and leave this widget alone. Listed as an initial HUD widget on the showroom's desktop pawn; the full menu is WBP_Menu.

KindNameSignatureDescription
eventWidgetElement_PostInitiateStyle()Called once the whole widget tree has been initiated and themed. Left empty here, so the vertical bar keeps the buttons it was given in the designer; the entries in Pages on the pawn's menu component are only read once a button is selected.

Widgets/Helper

WBP_Menu_Subpage1 members
extends WBP_Base

One entry's worth of the menu (WBP_Menu): a horizontal pagination row above a switcher that creates the selected page's widget and removes the previous one after it has faded. Initiate With Pages fills it from widget page data assets and collapses the row when there is only one. Created by the menu; not something to place yourself.

KindNameSignatureDescription
eventInitiateWithPages(Pages: PDA_WidgetPage[])Stores the page assets handed over, adds a tab for each of their buttons and selects the first, which brings its widget up. The tab row collapses when only one page was passed, so a single page entry shows nothing but its content. Called by the wrist menu as it creates the subpage.
WBP_Sidebar_Subpage1 members
extends WBP_Base

One entry's worth of the sidebar (WBP_Sidebar): a horizontal pagination row above a switcher that creates the selected page's widget. Initiate With Pages fills it from a list of widget page data assets, and the row collapses when there is only one page. Created by the sidebar; not something to place yourself.

KindNameSignatureDescription
eventInitiateWithPages(Pages: PDA_WidgetPage[])Stores the page assets handed over, adds a tab for each of their buttons and selects the first, which brings its widget up. The tab row collapses when only one page was passed, so a single page entry shows nothing but its content. Called by the desktop menu as it creates the subpage.

Widgets/Settings

WBP_Settings_Desktop_Gameplay0 members
extends WBP_Base

Gameplay tab of the desktop settings screen: a scrolling column that as shipped holds a single row, the theme selector. Add setting items to it to give your project's gameplay options a home, or copy it as the pattern for a tab of your own.

No editor-visible members; this asset configures defaults only.

WBP_Settings_Desktop_Graphics0 members
extends WBP_Base

Graphics tab of the desktop settings screen: a scrolling column of setting rows bound to the console-variable settings presets, covering pixel density, shadows, post process, effects, fixed foveated rendering, foliage, textures and view distance. Copy it and change the preset on each row to offer a different set.

No editor-visible members; this asset configures defaults only.

WBP_Settings_Desktop_Sound0 members
extends WBP_Base

Sound tab of the desktop settings screen: sliders bound to the master, music, effects and voice volume settings presets. Copy it and point each slider at a different preset if your project mixes its audio some other way.

No editor-visible members; this asset configures defaults only.

WBP_Settings_Mobile_Gameplay0 members
extends WBP_Base

Gameplay tab of the mobile settings screen: setting rows bound to the comfort and interaction presets, laid out in the widget tree with no logic behind them. Unlike the VR tab it does not collapse anything, so every row stays visible. Copy it and change the preset on each row to offer a different set.

No editor-visible members; this asset configures defaults only.

WBP_Settings_Mobile_Graphics0 members
extends WBP_Base

Graphics tab of the mobile settings screen, bound to the console-variable quality presets. The mobile counterpart of the desktop tab, with the settings a phone can actually act on.

No editor-visible members; this asset configures defaults only.

WBP_Settings_Mobile_Sound0 members
extends WBP_Base

Sound tab of the mobile settings screen: sliders bound to the master, music, effects and voice volume presets.

No editor-visible members; this asset configures defaults only.

WBP_Settings_VR_Gameplay0 members
extends WBP_Base

Gameplay tab of the VR settings screen, and the one that matters most in a headset: the comfort rows bound to their settings presets. The teleport, locomotion and turn toggles each collapse the rows beneath them when switched off, so options that no longer apply disappear instead of sitting there inert. The tab to copy when building a comfort screen of your own.

No editor-visible members; this asset configures defaults only.

WBP_Settings_VR_Graphics0 members
extends WBP_Base

Graphics tab of the VR settings screen, bound to the console-variable quality presets. The VR counterpart of the desktop tab.

No editor-visible members; this asset configures defaults only.

WBP_Settings_VR_Sound0 members
extends WBP_Base

Sound tab of the VR settings screen: sliders bound to the master, music, effects and voice volume presets.

No editor-visible members; this asset configures defaults only.

Widgets/Settings/Helper

WBP_SettingItem3 members
extends WBP_Base

Base widget for one row of a settings screen: an info row carrying the setting's name and caption with a named slot for the control. Set Settings to the settings value class the row edits and it does the rest. Add one of the toggle, slider, selector, colour picker or drop-down variants, or subclass this when the control is your own.

KindNameSignatureDescription
varSettingsSettingsclass<BP_Value_Settings>Value class of the setting this row edits, picked per instance in the designer or passed in when the row is spawned. The shared object for that class lives on the game state's settings component, which creates it on first use. Leave it unset and the row has nothing to read from or write to.
fnWidgetElement_getNamedSlotsSlots(out Slots: NamedSlot[])Returns the single config item slot that sits beside the info row's title and caption, so that the control you place there is initiated and themed with the rest of the tree.
eventWidgetElement_PostInitiateStyle()Called once the whole widget tree has been initiated and themed. Empty on the base row, which is where a row of your own resolves Settings into its shared value object and binds the control in the config slot to it.
WBP_SettingItem_Boolean_Toggle1 members
extends WBP_SettingItem

Settings row whose control is a toggle, aligned to the right of the row. Point Settings at a boolean settings value class to put that setting on a screen. Unused as shipped, so it is there for you to place.

KindNameSignatureDescription
eventWidgetElement_PostInitiateStyle()Called once the whole widget tree has been initiated and themed. Empty on the toggle row, so nothing yet ties the switch in the config slot to the boolean value object named by Settings; that binding belongs here.
WBP_SettingItem_Color_Picker1 members
extends WBP_SettingItem

Settings row whose control is a colour picker. Point Settings at a colour settings value class to let the player choose it on a settings screen. Unused as shipped, so it is there for you to place.

KindNameSignatureDescription
eventWidgetElement_PostInitiateStyle()Called once the whole widget tree has been initiated and themed. Empty on the colour row, so the swatch in the config slot neither shows the value object named by Settings nor writes a new colour back to it until you bind it here.
WBP_SettingItem_Float_Slider1 members
extends WBP_SettingItem

Settings row whose control is a slider. Point Settings at a float settings value class; the shipped graphics and sound tabs use it for pixel density and for the four volume mixes.

KindNameSignatureDescription
eventWidgetElement_PostInitiateStyle()Called once the whole widget tree has been initiated and themed. Empty on the slider row, so the slider in the config slot is not yet driven by the float value object named by Settings, and a drag is not written back to it.
WBP_SettingItem_Integer_Selector1 members
extends WBP_SettingItem

Settings row whose control steps through whole numbers. Point Settings at an integer settings value class; the shipped graphics tab uses it for every quality level it offers.

KindNameSignatureDescription
eventWidgetElement_PostInitiateStyle()Called once the whole widget tree has been initiated and themed. Empty on the selector row; this is where the button group in the config slot is handed the integer value object named by Settings, which supplies both the choices to show and the index selected.
WBP_SettingItem_Name_DropDown1 members
extends WBP_SettingItem

Settings row whose control is a drop-down of named options. Point Settings at a name settings value class; the shipped gameplay tab uses it for the theme selector.

KindNameSignatureDescription
eventWidgetElement_PostInitiateStyle()Called once the whole widget tree has been initiated and themed. Empty on the drop-down row; this is where the list in the config slot is handed the name value object named by Settings, which supplies the identifiers and labels to offer.
WBP_SettingsFrame_Buttons0 members
extends WBP_Base

Save and Reset buttons a settings frame shows along its foot, and they do the work themselves rather than reporting to the frame: Reset calls Reset All Settings on the game state's settings component, and Save calls Save All Settings and raises a notification confirming it. Subclass it to change what the row offers.

No editor-visible members; this asset configures defaults only.