> For the complete documentation index, see [llms.txt](https://docs.msquared.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.msquared.io/creation/unreal-development/features-and-tutorials/ui/ui-mode.md).

# "UI Mode"

{% hint style="success" %}
verified: 2025-11-20 version: v39
{% endhint %}

We commonly use the concept of "UI Mode", as an equivalent for Unreal's `Input Mode`s. 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.

<figure><img src="/files/gFVtMD8HiciTHUV3stIn" alt=""><figcaption><p>An example "UI mode" implementation - when we want to release the mouse and enable clicking, we use <code>SetInputModeGameAndUI</code>, and show the mouse cursor, and use <code>SetInputModeGameOnly</code> when we want to capture the cursor.</p></figcaption></figure>

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`

  <figure><img src="/files/ZKQw75MFB8en0nYFa6Kh" alt=""><figcaption><p>The example settings menu requests UI mode, since we need the mouse to be available to click on things.</p></figcaption></figure>
* 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.

  <figure><img src="/files/7Sn5drfy6bYiZeECnzy6" alt=""><figcaption></figcaption></figure>
* The example player controller listens to these UI mode requests using `BindToUIModeChangeRequests`, setting the input mode accordingly.

  <figure><img src="/files/Cybu2zYkltHhf5764na5" alt=""><figcaption></figcaption></figure>

## 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".
