APlayerController::SetInputMode (Game And UI)
#include "GameFramework/PlayerController.h"
Access: public
Description
Hybrid input mode where both game input and UMG widget input are active simultaneously. Useful for in-world inventory screens, minimap overlays, or radial menus that coexist with live gameplay. The cursor is typically shown; game input continues unless a widget captures it.
Signature
void SetInputMode(FInputModeGameAndUI InData) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InData | FInputModeGameAndUI | Input mode struct; configure widget focus and mouse lock behavior. | — |
Return Type
void Caveats & Gotchas
- • A widget consuming a mouse click will prevent the game from receiving it — be mindful of input event consumers.
- • Use `SetHideCursorDuringCapture(false)` on the struct to keep the cursor visible while the viewport captures mouse input.
Example
Show an inventory overlay during gameplay C++
FInputModeGameAndUI Mode;
Mode.SetWidgetToFocus(InventoryWidget->TakeWidget());
Mode.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
Mode.SetHideCursorDuringCapture(false);
PC->SetInputMode(Mode);
PC->SetShowMouseCursor(true); See Also
Version History
Introduced in: 4.5
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
| 5.0 | stable | — |
Feedback
Was this helpful?