"UI Mode"

We commonly use the concept of "UI Mode", as an equivalent for Unreal's Input Modes. We switch between a "game mode" (where the mouse is captured and used as camera rotation), and a "UI mode", where the mouse is released, and users are allowed to click on things.

An example "UI mode" implementation - when we want to release the mouse and enable clicking, we use SetInputModeGameAndUI, and show the mouse cursor, and use SetInputModeGameOnly when we want to capture the cursor.

We have introduced an example helper library: BPFL_UIModeHelpers, which provides a unified way of making external systems request UI mode, and make it handle them in a single place.

  • In various UI elements, we call RequestUIMode, and provide the widget as the context. When done, we call ReleaseUIModeRequest

    The example settings menu requests UI mode, since we need the mouse to be available to click on things.
  • Each request made is passed in to the BP_UIModeService, which tracks how many different context objects are requiring UI mode. If there are any objects that do, we want to be in UI mode. If all the objects needing UI mode have released their requests, we no longer need to be in UI mode.

  • The example player controller listens to these UI mode requests using BindToUIModeChangeRequests, setting the input mode accordingly.

A note on mobile controls

The "input mode: Game vs UI vs Game & UI" doesn't really hold when using mobile controls, since all input goes through the touch screen. In our example content we therefore ignore this UI mode system on mobile, setting ourselves to always be in "UI mode".

Last updated

Was this helpful?