Storm Game Framework 2.0.0
User guide
Loading...
Searching...
No Matches
Add a screen

Add a help screen to the same project. You will give CommonUI a layout, register the screen by tag, and open it for the local player once the character is ready.

Before you start

Complete Add your first game rule. Keep CommonGameViewportClient configured as described in dashboard settings.

Add the gameplay tag UI.Widget.Tutorial.Help in your project's Gameplay Tags settings.

Copy the layout and registry

Enable Show Plugin Content and open SGF Content > SGFUI > UI > Examples. Copy WB_StormPrimaryLayout_Example and DA_StormWidgetRegistry_Example into Tutorial/UI. Name the copies WB_TutorialLayout and DA_TutorialWidgetRegistry.

The layout owns the actual CommonUI layer stacks. The registry maps screen tags to widget classes and destination layers. Its layer definitions must agree with the stack registrations in the layout.

Open both copies. Keep the existing layer table and the layout's Construct-time Register Layer Stack calls. Use the existing UI.Layer.Menu stack layer for help. Its registry definition and stack registration must use that same tag; a registry entry alone does not create a stack.

Create the help widget

  1. Create a Widget Blueprint in Tutorial/UI named WB_TutorialHelp, choosing CommonActivatableWidget as its parent.
  2. In Designer, add a centred panel with text describing WASD, mouse look, 2 for views, 3 for inventory inspection, 4 for equipment inspection, 5 for interaction and 7 for help.
  3. Add a focusable Button named CloseButton with the text Close. Mark it Is Variable.
  4. In its On Clicked graph, call Deactivate Widget on self.
  5. In Class Defaults, enable Is Back Handler and keep Supports Activation Focus enabled.
  6. Override Get Desired Focus Target and return CloseButton.
  7. Override Get Desired Input Config. Return Make UIInputConfig with Input Mode = Menu, Mouse Capture Mode = No Capture, and Hide Cursor During Viewport Capture = false. Compile and save.

On WB_TutorialLayout, provide Get Desired Input Config with Input Mode = Game and Mouse Capture Mode = Capture Permanently Including Initial Mouse Down. The active help screen overrides it; closing the screen restores the gameplay configuration. Keep input-mode changes in CommonUI's active widget configuration.

For Back handling in a blank project, open Project Settings > Game > Common Input Settings and select the engine CommonUI plugin's GenericInputData as Input Data if no project input data is configured. Its Back action supplies the standard bindings. Existing projects should keep their own CommonUI input data and check its Back binding. In PIE, Escape may be reserved to stop play; use the Close button and repeat the Back test in a standalone game or package.

Register the help screen

In DA_TutorialWidgetRegistry > Widgets, add an entry:

Field Value
Widget Tag UI.Widget.Tutorial.Help
Widget Class WB_TutorialHelp
Layer Tag UI.Layer.Menu
Pause Policy None, so this also works in the multiplayer tutorial.
Duplicate Policy BringToFront
Suppress While Loading Enabled.

In Project Settings > Game > Storm UI, set Default Primary Layout Class to WB_TutorialLayout and Widget Registry to DA_TutorialWidgetRegistry. Keep Auto Create Layout on Player Controller Ready enabled. Save.

Give the local controller an entry point

Create a Blueprint child of StormNativeHumanoidController, named BP_TutorialController, in Tutorial/UI. This retains the camera controller selected in the character chapter and adds your screen entry point.

  1. Add a Storm UI Entry Point component named HelpEntry.
  2. Set Entry Widget Tag to UI.Widget.Tutorial.Help and turn off Show On Begin Play.
  3. In its Event Graph, add keyboard 7. Require Is Local Controller, then call HelpEntry > Show Entry Widget.
  4. Compile and save. In BP_PlayerCharacter_GameMode > Class Defaults, set Player Controller Class to BP_TutorialController. Compile and save.

The entry component belongs on the player controller. Its early BeginPlay can run before Unreal assigns the local player, and a pawn's configuration readiness can arrive before its local controller. Make startup wait for both conditions:

  1. In BP_TutorialController, add a custom event TryOpenStartupHelp. Require Is Local Controller, a valid Get Pawn, a successful cast to BP_PlayerCharacter and that pawn's Is Character Ready.
  2. When those checks pass, call HelpEntry > Show Entry Widget. If it returns true, clear and invalidate a StartupHelpTimer handle.
  3. From BeginPlay, use Set Timer by Event, interval 0.1 seconds, Looping on, bound to TryOpenStartupHelp. Save its returned handle in StartupHelpTimer.
  4. Bound the startup wait: count attempts in the event and clear the timer after 300 attempts if it has not succeeded. A local player can still use 7 to retry; remote server controllers should expire quietly. Clear the handle on EndPlay too.

Keep the prop's character-readiness handler from the previous chapter. Help startup belongs to this controller loop, which can observe local ownership even when it arrives after configuration readiness.

Show Entry Widget requests immediately if the layout is ready, or waits for layout readiness. It returns a Boolean describing whether it requested or arranged the screen. Missing tags and registry entries are configuration problems, reported in the Output Log.

Play and check

Play the level. The help screen should appear once the local character is ready. CloseButton should receive keyboard focus. Close it using Enter or a click, confirm movement and mouse look work again, then press 7 to reopen it. Check Back in a standalone game or Development package.

The tutorial help screen shown over the running supply-room project.

With two PIE players, each local viewport should have its own layout and help screen. Opening one player's help must not open a second screen for the other player or pause the server.

If something does not match

Symptom Check
No screen appears. Check the actual game mode/controller, readiness handler, tag, registry and selected layer.
The log says the layout is not routable. Match every registry layer to a stack registration in the layout.
Mouse capture remains on the game. Check both widgets' Get Desired Input Config overrides and the CommonUI viewport.
Back does not close it. Check Is Back Handler, Common Input Data and the game's Back binding outside PIE.
Startup help is absent but 7 works. Check the controller's startup timer, local ownership, ready pawn and timer-clear condition.

Checkpoint: the local player can open, focus, close and reopen a screen, with CommonUI restoring gameplay input afterwards.

Next: Use your own level and package it.