Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Unreal Enhanced Input?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tipoli5890-unreal-enhanced-input)
---
name: unreal-enhanced-input
description: >-
Unreal Enhanced Input: Input Actions, Mapping Contexts, BindAction in C++, triggers, modifiers,
AddMappingContext; a key that does nothing.
---
# unreal-enhanced-input — actions, contexts and bindings
An input action is a data asset, a mapping context ties keys to it, and C++ binds a handler to its trigger events; a key that does nothing is almost always a context that was never added.
The two halves run in different places: the **context** is added to the local player's subsystem on the machine that owns that player, the **bindings** are made on the pawn's input component when a PlayerController possesses it. Code that does one half, or does it on the server, reads correctly and moves nothing.
## Load what the situation needs
| The situation | Read |
|---|---|
| Setting input up for a new character | *The method* below, `templates/CourierInputConfig.h` |
| Which value type, trigger or modifier an action needs; context priority | `reference/actions-and-contexts.md` |
| Where to call `AddMappingContext`; the binding code; the Build.cs line; default input classes | `reference/binding.md` |
| "Nothing happens when I press the key", "works for the host only", "fires twice" | *Nothing fires* below, then `reference/debugging-input.md` |
| A headless test that drives an action | `reference/debugging-input.md` §3 |
| Checking a project's C++ set-up before running it | `scripts/input_lint.py` |
| The pawn, controller and possession order | `unreal-gameplay-framework` |
| Module and plugin entries in general | `unreal-modules-build` |
## The method
1. **Depend on the module.** The game module's Build.cs lists `"EnhancedInput"` (private, or
public when a public header includes an Enhanced Input header). The Enhanced Input plugin is
enabled by default; a `.uproject` that lists it with `"Enabled": false` breaks every step below.
2. **Make the actions** (`UInputAction` assets: `IA_Move` Axis2D, `IA_Jump` and `IA_Vault`
Digital). The value type is a contract with the handler.
3. **Make the context** (`IMC_Courier`): one mapping per key, with modifiers per mapping (WASD on
one Axis2D action needs Swizzle Input Axis Values on W and S, Negate on S and A).
4. **Gather them** in a `UCourierInputConfig` data asset (`templates/`), so the character holds one
reference and `IsReady()` names any empty slot.
5. **Add the context on the owning machine**: in the pawn's `NotifyControllerChanged` (runs on the
server and the owning client on each controller change), skipping a controller without a local
player. Never in a constructor, never in `PossessedBy` (server only).
6. **Bind in `SetupPlayerInputComponent`**: `Cast<UEnhancedInputComponent>`, log if it fails, then
one `BindAction` per action and trigger event.
7. **Check**: `scripts/input_lint.py` on the project, then `showdebug enhancedinput` in a running
game to see the contexts the local player really has.
Steps 5 and 6 for the courier (the full listing with includes is `reference/binding.md`):
```cpp
void ACourierCharacter::NotifyControllerChanged()
{
Super::NotifyControllerChanged();
APlayerController* PC = GetController<APlayerController>();
ULocalPlayer* LocalPlayer = PC ? PC->GetLocalPlayer() : nullptr;
if (LocalPlayer && InputConfig && InputConfig->IsReady())
{
if (UEnhancedInputLocalPlayerSubsystem* Subsystem =
LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>())
{
Subsystem->AddMappingContext(InputConfig->DefaultMappingContext, 0);
}
}
}
void ACourierCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
UEnhancedInputComponent* Input = Cast<UEnhancedInputComponent>(PlayerInputComponent);
if (!Input || !InputConfig || !InputConfig->IsReady())
{
UE_LOG(LogTemp, Error, TEXT("Courier input not bound"));
return;
}
Input->BindAction(InputConfig->MoveAction, ETriggerEvent::Triggered, this, &ACourierCharacter::HandleMove);
Input->BindAction(InputConfig->JumpAction, ETriggerEvent::Started, this, &ACourierCharacter::HandleJumpStarted);
Input->BindAction(InputConfig->JumpAction, ETriggerEvent::Completed, this, &ACourierCharacter::HandleJumpCompleted);
Input->BindAction(InputConfig->VaultAction, ETriggerEvent::Triggered, this, &ACourierCharacter::HandleVault);
}
```
A handler takes `const FInputActionInstance&` and reads `Instance.GetValue().Get<FVector2D>()`
(or `Get<bool>()`, `Get<float>()`, `Get<FVector>()`) to match the action's value type.
## Trigger events in one table
| Event | When it fires | Typical use |
|---|---|---|
| `Started` | evaluation begins; before `Triggered` when both happen in one frame | jump on press |
| `Ongoing` | still being evaluated (a hold not yet long enough) | a charge meter |
| `Triggered` | the triggers report triggered, every tick they do | movement, a completed hold |
| `Completed` | went from Triggered to None this frame | cut the jump on release |
| `Canceled` | evaluation stopped without triggering (a hold let go early) | cancel the charge |
Context priority: when several active contexts map the input an action needs, the highest
priority context is used and the others are ignored. Triggers combine as Explicit, Implicit and
Blocker (`reference/actions-and-contexts.md` §3).
## Nothing fires
The causes in the order to suspect them (all thirteen, with fixes: `reference/debugging-input.md`):
1. **No context on this machine.** `showdebug enhancedinput` lists none: the add is in a
constructor, in `PossessedBy`, behind `HasAuthority()`, or ran before a local player existed.
2. **The cast returned null.** `DefaultInputComponentClass` in `Config/DefaultInput.ini` names a
class that is not `UEnhancedInputComponent`; the bind function returns early.
3. **Not possessed by a PlayerController.** `SetupPlayerInputComponent` never ran.
4. **Wrong event or wrong asset.** A Hold action bound to `Started`; the config points at a
different `IA_` asset than the context maps.
5. **Shadowed.** A higher-priority context maps the same key.
6. **Value type mismatch.** `Get<FVector2D>()` on a Digital action, or WASD without swizzle.
7. **Legacy bindings.** `BindAxis("MoveForward", ...)` binds a project-settings Axis mapping, not
an Input Action asset.
## Check it without the engine
```bash
python3 scripts/input_lint.py /path/to/CourierRun
python3 scripts/input_lint.py /path/to/CourierRun --context-in-blueprint # a Blueprint adds the context
python3 scripts/input_lint.py /path/to/CourierRun --strict # warnings fail too
```
FAIL lines: a module that includes Enhanced Input headers without the Build.cs dependency, the
plugin disabled in the `.uproject`, bound actions with no `AddMappingContext` in any C++ file, an
add in a constructor or in `PossessedBy`, and a default input component class that makes the
cast fail. WARN lines: a public header with only a private dependency, legacy name-based bindings.
It reads no Blueprint and no `.uasset`; `PASS 0 C++ files read` is not a pass, and exit 3 says so.
## Related skills
- The character, controller and possession flow: `unreal-gameplay-framework`
- Activating the vault ability from `HandleVault`: `unreal-gas`
- Build.cs and plugin entries: `unreal-modules-build`
- Console commands in a scripted run: `unreal-editor-python`
- Driving input in automation tests: `unreal-automation-tests`