APlayerController::SetInputMode (UI Only)
#include "GameFramework/PlayerController.h"
Access: public
Description
Routes all input to Slate/UMG widgets only — game input (character movement, actions) is blocked entirely. Use for full-screen menus or loading screens where gameplay actions must be suppressed. Pair with `SetShowMouseCursor(true)` for full cursor-driven UI.
Signature
void SetInputMode(FInputModeUIOnly InData) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InData | FInputModeUIOnly | Input mode struct; set widget focus via SetWidgetToFocus. | — |
Return Type
void Caveats & Gotchas
- • Game-side Enhanced Input bindings receive no events while in UI-only mode.
- • Set a focused widget via `FInputModeUIOnly::SetWidgetToFocus()` to enable keyboard navigation.
- • Remember to switch back to Game-only or GameAndUI when the UI closes.
Example
Open a pause menu C++
void AMyHUD::OpenPauseMenu()
{
APlayerController* PC = GetOwningPlayerController();
PC->SetShowMouseCursor(true);
FInputModeUIOnly Mode;
Mode.SetWidgetToFocus(PauseMenuWidget->TakeWidget());
Mode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
PC->SetInputMode(Mode);
} See Also
Version History
Introduced in: 4.5
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
| 5.0 | stable | — |
Feedback
Was this helpful?