How-To: Push & Pop Screens
Goal: open a menu screen on a layer, hand it data, close it, and optionally block input while a heavy widget streams in.
UCrimsonActivatableWidget (or any UCommonActivatableWidget).1. Make the screen a Crimson activatable widget
Create your screen Blueprint with parent Crimson Activatable Widget. In Class Defaults, category Input, pick how it routes input while active:
InputConfig value | Meaning | Typical use |
|---|---|---|
Default | Leave the current input config untouched | HUD elements, overlays that must not steal input |
GameAndMenu | UI receives input, unhandled input still reaches the game | Interaction prompts, radial menus, quick-slots |
Game | Game input only | The HUD layout itself |
Menu | UI captures everything | Pause menu, settings, inventory |
GameMouseCaptureMode / MenuMouseCaptureMode control mouse capture per mode; bIgnoreMoveInput / bIgnoreLookInput additionally freeze pawn movement/camera while the widget is active. See Concept: Input Routing & Activatable Widgets for how these apply and restore.
InputConfig = Menu, pushing the screen shows the cursor and stops pawn input; closing it restores gameplay input.2. Push it
Use the async Push Content To Layer For Player when the class is a soft reference or you want the BeforePush hook. For an already-loaded hard class, the synchronous node of the same name on Crimson UI Extensions returns the widget directly - then set variables on the return value.
3. Close it
Two equivalent paths: from inside the screen call Deactivate Widget (CommonUI removes a deactivated widget from its stack); from outside call Pop Content From Layer with the widget reference.
// Inside the widget:DeactivateWidget();// From outside (CrimsonCommon):UCrimsonUIExtensions::PopContentFromLayer(Widget);// Find-and-remove when you only know the class/instance:Layout->FindAndRemoveWidgetFromLayer(Widget);
4. Suspend input during transitions
The async push already suspends input while streaming (its bSuspendInputUntilComplete defaults to true). For your own transitions, Suspend Input For Player returns a token; pass the same token to Resume Input For Player. Both live on Crimson UI Extensions (CrimsonCommon) and are BlueprintCallable.
const FName Token = UCrimsonUIExtensions::SuspendInputForPlayer(PC, TEXT("CinematicIntro"));// ... later ...UCrimsonUIExtensions::ResumeInputForPlayer(PC, Token);
See also
- How-To: Get the Building Blocks - all the getter chains used above.
- Concept: Input Routing & Activatable Widgets - what happens on activate/deactivate.
- How-To: Show Confirmation Dialogs - modal-layer pushes with a result callback.