UEnhancedInputLocalPlayerSubsystem
#include "EnhancedInputSubsystems.h" Description
A local player subsystem that manages which UInputMappingContexts are active for a player. Use it to add, remove, or prioritise input contexts at runtime.
Caveats & Gotchas
- • Access via ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PC->GetLocalPlayer()). Returns null if the plugin is disabled or called before the player is initialised.
- • The subsystem is per-local-player — in split-screen, each player has their own subsystem. Do not use player index 0 to address all players.
- • Mapping contexts must be added here before any input events fire. A common mistake is binding actions in SetupPlayerInputComponent but forgetting to AddMappingContext in BeginPlay.
Example
Get subsystem from a PlayerController C++
APlayerController* PC = Cast<APlayerController>(Controller);
UEnhancedInputLocalPlayerSubsystem* Sub =
ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PC->GetLocalPlayer());
if (Sub)
{
Sub->AddMappingContext(DefaultContext, 0);
} Functions (3)
Utility 3 ▼
| Access | Type | Name |
|---|---|---|
| public | function | UEnhancedInputLocalPlayerSubsystem::AddMappingContext |
| public | function | UEnhancedInputLocalPlayerSubsystem::ClearAllMappings |
| public | function | UEnhancedInputLocalPlayerSubsystem::RemoveMappingContext |
Tags
Version History
Introduced in: 5.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?