# UI Mode

When opening a widget or in other various scenarios, you may want to the mouse to become visable and allow the player to interact with widgets on screen using the mouse. To do this, use the blueprint function library functions: `MarkContextNeedsUIMode` and `UnmarkContextNeedsUIMode` respectively.

<figure><img src="https://33425813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbIBFTVTQoxu1YByrB4tU%2Fuploads%2FMYSSbVCk6EEsX7FUYRKu%2Fimage.png?alt=media&#x26;token=59f57ae3-6fe3-4e38-b7c7-3c2429102017" alt=""><figcaption><p>Example of function usage</p></figcaption></figure>

You must provide a "Context" when calling these functions. This context represents the object who wants UI mode to be enabled/disabled.\
\
If multiple calls are made to `MarkContextNeedsUIMode` with different contexts, calling `UnmarkContextNeedsUIMode` once with one of the contexts will not disable UI mode. The system will always ensure the highest UI mode is enabled that at least on context needs.&#x20;

### Handling UI Mode Changes

`MarkContextNeedsUIMode` is a wrapper around the `BPC_ODK_UIModeComponent` component attached to `BP_ODK_PlayerControllerBase.` The `BPC_ODK_UIModeComponent` is not repsonible for the effects of UI mode change (showing the cursor for example). It is simply responsible for the maintance of the current UI mode state. `BP_ODK_PlayerControllerBase` handles the result of UI mode changes here:

<figure><img src="https://33425813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbIBFTVTQoxu1YByrB4tU%2Fuploads%2FZTvyqtAkXFvrKozgEqsp%2Fimage.png?alt=media&#x26;token=cc9e9e73-0046-4a2c-83a2-8b9c683e8c37" alt=""><figcaption><p>Handling of UI mode changes on the <code>BP_ODK_PlayerControllerBase</code> .</p></figcaption></figure>

If you require different logic to be perfomed when the UI mode changes, you can override the functionality is `HandleUIModeChangeRequest`.
