Wire player input the modern UE5 way with the Enhanced Input system: data-driven Input Actions and Mapping Contexts instead of the legacy Project Settings axis/action mappings. Targets UE 5.8 (Enhanced Input is the default; legacy input is deprecated).
IA_) and Input
Mapping Context (IMC_) assets, applying modifiers/triggers, adding a mapping context to a
player, or binding actions in C++ or Blueprints.IA_*/IMC_* assets or references EnhancedInput.When not to use: engine-agnostic input architecture (rebinding strategy, buffering,
multi-device design) → input-systems. The Pawn/Character C++ those bindings live in →
unreal-cpp-gameplay.
"EnhancedInput" to PublicDependencyModuleNames in *.Build.cs.IA_). Each has a Value Type: Digital (bool) for buttons,
Axis1D (float) for triggers, Axis2D (Vector2D) for movement/look.IMC_) that maps keys/buttons to those actions. Use
Modifiers to shape raw input (Negate, Swizzle Input Axis Values, Dead Zone) — e.g. WASD
into one Axis2D needs Negate on A/S and a Swizzle on W/S. Use Triggers (Pressed, Hold,
Tap) to decide when an action fires.EnhancedInputLocalPlayerSubsystem
(AddMappingContext(IMC, Priority)), usually in BeginPlay/possession.ETriggerEvent (Triggered, Started, Completed, …) on
the EnhancedInputComponent, and read the FInputActionValue in the handler.showdebug enhancedinput) show which actions trigger and their values.void AMyCharacter::BeginPlay()
{
Super::BeginPlay();
if (APlayerController* PC = Cast<APlayerController>(GetController()))
if (ULocalPlayer* LP = PC->GetLocalPlayer())
if (auto* Subsystem = LP->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>())
Subsystem->AddMappingContext(DefaultMappingContext, /*Priority*/ 0);
}
// DefaultMappingContext is a UPROPERTY(EditAnywhere) TObjectPtr<UInputMappingContext>.
void AMyCharacter::SetupPlayerInputComponent(UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
// The component is an Enhanced Input component when the plugin is active.
if (UEnhancedInputComponent* EIC = Cast<UEnhancedInputComponent>(InputComponent))
{
EIC->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AMyCharacter::Move);
EIC->BindAction(LookAction, ETriggerEvent::Triggered, this, &AMyCharacter::Look);
EIC->BindAction(JumpAction, ETriggerEvent::Started, this, &ACharacter::Jump);
EIC->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);
}
}
void AMyCharacter::Move(const FInputActionValue& Value)
{
const FVector2D Axis = Value.Get<FVector2D>(); // Axis2D action
AddMovementInput(GetActorForwardVector(), Axis.Y);
AddMovementInput(GetActorRightVector(), Axis.X);
}
Event BeginPlay
-> Get Controller -> Cast To PlayerController -> Get Local Player
-> Get EnhancedInputLocalPlayerSubsystem -> Add Mapping Context (IMC_Default, Priority 0)
// IA_Move is exposed as its own event node in the Character's Event Graph:
EnhancedInputAction IA_Move (Triggered)
-> Action Value (Vector2D) -> Add Movement Input (Forward * Y, Right * X)
AddMappingContext), or the
player has no Local Player yet. Add it after possession/BeginPlay."EnhancedInput" isn't in Build.cs
PublicDependencyModuleNames.Get<FVector2D>() returns zero — value-type mismatch: the Input Action is Digital/Axis1D,
not Axis2D. Match the Get<T>() to the action's Value Type.Triggered repeats while held for a Down trigger;
use Started/Completed for one-shots (jump press/release), or a Pressed/Tap trigger.RemoveMappingContext.references/cpp-setup.md.https://dev.epicgames.com/documentation/en-us/unreal-engine/enhanced-input-in-unreal-engine).input-systems — engine-agnostic input architecture and rebinding strategy.unreal-cpp-gameplay — the Character/Pawn class and module setup.fps-shooter — composes input with a 3D controller and shooting.