Home › Systems › AFS_UI_Popups
System

AFS_UI_Popups

Modal popups anchored in pawn UI space, with configurable buttons, icon, title and body.

What it gives you

  • Modal confirmation and message dialogs
  • Any number of buttons with hierarchy styling
  • Correct spatial placement on every platform

Requires

AFA_Colors AFM_Abilities AFS_UI AFS_UI_Pawn

Required by

AF_Examples

2 assets9 API members

Description

Popups are for decisions that must be made before continuing. BFL_Popups.Popup_ShowPopup_Default builds one from an icon, a title, body text and an array of button definitions, anchors it in pawn UI space and returns the widget so you can bind to the buttons.

Placement comes from a PDA_PawnUIPosition data asset, so a popup sits at a comfortable reading distance in VR and centred on screen on desktop, from the same call.

Setup

  1. Confirm the pawn has BPC_PawnAbility_PawnUI.
  2. Call the library function.

Usage

Showing a confirmation

Pass two entries in Button Contents and matching Button Presets to style one as primary and one as secondary. Bind to the returned widget's button delegates.

Blocking interaction behind the popup

Use setAbilityRestriction on the pawn to suppress interaction abilities while the popup is open, then release when it closes.

A modal popup with two buttons
AFS_UI_Popups_result.pngA modal popup with two buttons
A modal popup with two buttons

Key properties

PropertyWhen to change
Button Contents / Button PresetsThe buttons and their visual hierarchy
Position data assetWhere the popup sits relative to the player

Extending

Derive from WBP_Popup_Default for a different popup layout.

Example map

Map_Examples_Popups demonstrates several popup configurations.

Troubleshooting

The popup appears behind something. Its pawn UI position overlaps another element; give it a dedicated position data asset.

API reference

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

Libraries

BFL_Popups1 members
extends BlueprintFunctionLibrary

Function library for modal popups. Show Popup Default adds the default popup widget to the pawn's UI space at the popup position and fills in its icon, title, body, button row and sound in a single call, returning the widget so you can bind to its buttons. Called statically; the pawn needs the pawn UI ability for anything to appear.

KindNameSignatureDescription
fnPopup_ShowPopup_DefaultPopup(Pawn: Pawn, Outline_Color: PDA_Color, Icon_Color: PDA_Color, Icon: Texture2D, Title_Color: PDA_Color, Title: text, BodyText: text, ButtonContents: ST_Button_Content[], ButtonPresets: E_UI_Hierarchy[], Sound: SoundBase, __WorldContext: Object, out Popup Default: WBP_Popup_Default)Shows a modal popup in front of the given pawn and returns the widget so its button delegate can be bound. The pawn needs the Pawn UI ability component; the popup is placed by the shipped popup position asset, so it appears at a comfortable reading distance in VR and centred on screen elsewhere.

Widgets

WBP_Popup_Default8 members
extends WBP_Base

Default popup layout: an icon, a title, a body and a row of buttons inside an outlined scaffold, with each of the colours taking a colour data asset. Initiate Popup fills the whole thing in one call and plays the sound half a second later. Shown through the popup library; subclass or copy it when a popup of your own wants a different arrangement.

KindNameSignatureDescription
eventInitiatePopup(Outline_Color: PDA_Color, Icon_Color: PDA_Color, Icon: Texture2D, Title_Color: PDA_Color, Title: text, BodyText: text, ButtonContents: ST_Button_Content[], ButtonPresets: E_UI_Hierarchy[], Sound: SoundBase)Fills the popup in one pass — colours, icon, title, body and buttons — then plays the given sound half a second later so it lands with the appear animation rather than ahead of it. Called for you by Show Popup Default; call it directly only if you spawned the widget yourself.
eventUpdateIcon(Icon: Texture2D)Replaces the icon above the title. The image collapses when no texture is given, so the title moves up to fill the space.
eventUpdateTitle(Text: text)Replaces the popup's title text. The title collapses when the text is empty.
eventUpdateBody(Text: text)Replaces the body text and re-picks its alignment: under fifty characters it is centred, longer text is left-aligned so it stays readable. The body collapses when the text is empty.
eventUpdateButtons(ButtonContents: ST_Button_Content[], ButtonPresets: E_UI_Hierarchy[])Rebuilds the row of buttons along the bottom from the given contents and hierarchy presets, and collapses the row entirely when the contents array is empty. The two arrays are read in step, so the first preset styles the first button.
eventUpdateTitleColor(TitleColor: PDA_Color)Overrides the title colour with a colour asset, ignoring the theme. Use it to mark the popup as a warning or an error.
eventUpdateOutlineColor(OutlineColor: PDA_Color)Overrides the colour of the frame drawn around the popup. This is the strongest signal of severity the popup has, so it is worth setting on anything destructive.
eventUpdateIconColor(Color: PDA_Color)Overrides the tint applied to the icon, ignoring the theme. Pair it with the outline colour so the two agree.