Skip to main content

Input and Menu Key

Bindings​

The bindings are in the Input Mapping Context Input/IMC_ACS_Common, added by BP_ACS_PlayerController when the demo map starts (Add Mapping Context).

Input ActionKeyTriggerRole
AI_ACS_MoveW, A, S, DMove the controlled character
AI_ACS_LookViewMouse XYLook around (when the mouse cursor is hidden)
AI_ACS_JumpSpace BarPressedJump
AI_ACS_MouseCursorLeft AltPressedShow / hide the mouse cursor
AI_ACS_Special_1 to _3Num 1, Num 2, Num 3HoldSwitch to the character 1, 2, 3 of the party
AI_ACS_Special_4Num 4PressedSwitch to the character 4 of the party
AI_ACS_MenuEscapePressedOpen the party menu, go back, close a popup

Change a key in IMC_ACS_Common. To add an action, create an Input Action asset, map it in IMC_ACS_Common and add its event in BP_ACS_PlayerController (or in a widget, as below).

AI_ACS_Menu is listened by the widgets themselves: an Enhanced Input action event placed in a Widget Blueprint registers the widget input component on the player controller. The key then works:

  • whatever has the keyboard focus. A click in the 3D view gives the focus to the game viewport, and a widget On Key Down override stops receiving the keys;
  • while the party menu is open, even though the player controller has disabled its own input (Disable Input in OpenPartyMenu).

HUD and party menu​

BalladDemo/WBP_ACS_BalladScreen:

The menu key in WBP_ACS_BalladScreen

  1. EnhancedInputAction AI_ACS_Menu calls Handle Menu Key
  2. On the HUD (switcher index 0): Call Open Menu, the same event as the Menu button
  3. In the party menu: Handle Back Key of the party screen

Party/WBP_ACS_PartySelector_Screen does what the visible back button does: Back Game (Close UI) in Party Formation, Back (Cancel Switch Character) in Select Character, nothing while the Edit Team Name popup is open:

HandleBackKey of the party screen

Popups​

WBP_ACS_ModalConfirmBox answers No (Call On Cancel) and WBP_ACS_AlertBox answers OK (Call On Confirm):

The menu key in WBP_ACS_ModalConfirmBox

In their Class Defaults (Input category), the two popups have a Priority of 10 and Stop Action checked: their input component runs first and blocks the lower ones, so the screen under an open popup never gets the key.

Escape in Play In Editor

By default, Escape stops Play In Editor (Editor Preferences > Keyboard Shortcuts > Play World > Stop). Bind Stop to another key (for example Shift + Escape) to test the menu key in the editor. In Standalone and in a packaged game, Escape always reaches the game.

Mouse cursor​

Left Alt shows or hides the mouse cursor in the demo map (hidden: the mouse looks around). The party menu always needs the cursor, so BP_ACS_PlayerController shows it when the menu opens and puts the previous state back when the menu closes:

ShowCursorForMenu and RestoreCursorAfterMenu

Show Cursor For Menu is the first node of OpenPartyMenu, Restore Cursor After Menu the last node of ClosePartyMenu (see Custom Implementation).

In Party Formation, the cursor becomes a hand over a character: BP_ACS_PartyMenuManager sets the player controller Current Mouse Cursor and gives the focus back to the game viewport (the viewport only shows the controller cursor while it has the focus). See Architecture.