Enhanced Input in Rephrased¶
How player input is wired in this repo. The project uses Enhanced Input for every gameplay action.
For the general Enhanced Input concepts (IA_*, IMC_*, binding, triggers), see Enhanced Input overview.
Wiring in this codebase¶
ARephraseCharacter declares one UInputMappingContext* and one UInputAction* per gameplay verb:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
UInputMappingContext* DefaultMappingContext;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
UInputAction* MoveAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
UInputAction* JumpAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
UInputAction* InteractAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
UInputAction* SplitRuneAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
UInputAction* ResetAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
UInputAction* ToggleDebugModeAction;
The C++ side declares the variables; the Blueprint subclass of the character (in Content/Blueprints/) assigns the actual IA_* and IMC_* assets. Engineers shouldn't be editing Content browser assignments by hand — wire it in BP and it stays out of the C++ diff.
At BeginPlay¶
The character pushes its mapping context onto the local player's input subsystem. Conceptually:
if (APlayerController* PC = Cast<APlayerController>(GetController()))
{
if (ULocalPlayer* LP = PC->GetLocalPlayer())
{
if (UEnhancedInputLocalPlayerSubsystem* InputSub =
LP->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>())
{
InputSub->AddMappingContext(DefaultMappingContext, 0);
}
}
}
(Implementation detail lives in RephraseCharacter.cpp.)
After that, the engine routes physical input through the mapping context to the actions, and the action's bound function fires.
Binding actions to functions¶
In SetupPlayerInputComponent:
UEnhancedInputComponent* EIC = Cast<UEnhancedInputComponent>(PlayerInputComponent);
EIC->BindAction(MoveAction, ETriggerEvent::Triggered, this, &ARephraseCharacter::Move);
EIC->BindAction(InteractAction, ETriggerEvent::Triggered, this, &ARephraseCharacter::Interact);
Most binds in this project use Triggered for simplicity; that is fine for buttons that aren't held.
Adding a new action here¶
- Create
IA_Fooand add it toIMC_DefaultinContent/Input/. - Add a
UInputAction*field and handler onARephraseCharacter. - Bind in
SetupPlayerInputComponent. - Assign the asset in the character Blueprint subclass.
Gamepad support¶
Each IMC_* row can hold both a keyboard key and a gamepad input. Per the TDD, gamepad-for-UI hardening is a future pass; gameplay input is wired today.
Source files¶
Source/Rephrased_Demo/RephraseCharacter.h— declarations of the input action and mapping context fields.Source/Rephrased_Demo/RephraseCharacter.cpp—BeginPlaypush andSetupPlayerInputComponentbinds.
Change history¶
- 2026-05-23 — Gabriel Li — Fixed BeginPlay snippet (
APlayerControllercast beforeGetLocalPlayer). - 2026-05-08 — Gabriel Li — Added baseline change history section for weekly wiki maintenance.