Gameplay, UI & Audio · Beginner · 15 min
Player Input with Enhanced Input: Make Your Character Respond to Keys
Wire up keyboard and gamepad controls the modern UE5 way — create Input Actions, group them in an Input Mapping Context, add that context to your pawn, and handle a key press in the Event Graph.
Before this: What Is a Blueprint? Create Your First One (No Code Required), Event Graph Basics: BeginPlay, Nodes, and Wires Explained
- Understand what Enhanced Input is and why UE5 uses it
- Create an Input Action and an Input Mapping Context
- Add the mapping context to your player pawn
- Handle an Input Action event in the Blueprint Event Graph
What Enhanced Input is — and why you'll use it
A game isn't a game until pressing a key makes something happen. In Unreal Engine 5, the standard way to read player input — keyboard, mouse and gamepad — is a system called Enhanced Input. It's the modern replacement for the old 'Action and Axis Mappings' you may have seen in older tutorials, and it's what the built-in templates use today.
Enhanced Input is built on two small pieces. An Input Action is a thing the player can do — 'Jump', 'Fire', 'Move'. An Input Mapping Context is a list that says which physical keys trigger which actions — for example, 'Spacebar triggers Jump'. You add a context to your player, and from then on Unreal fires a tidy event whenever the player presses a mapped key.
Why the extra layers instead of 'when Spacebar pressed, jump'? Because real games need to rebind keys, support a gamepad and a keyboard at once, and swap entire control schemes (on foot vs in a menu vs driving) without rewriting your logic. Enhanced Input gives you all of that for free. We'll build the simplest possible version now so the pieces click into place.
Four terms to lock in first
Tap a card to flip it
Before you start
Tick these so the steps line up with what's on your screen:
- An open project — the Third Person template is ideal because it already uses Enhanced Input you can learn from
- The Enhanced Input plugin enabled (it is on by default in new UE5 projects)
- You know how to open a Blueprint and add nodes in the Event Graph (see the prerequisite lessons)
- A few minutes — we'll make one action, map one key, and print a message when it's pressed
Build your first input, step by step
We'll create an Input Action called 'Interact', map the E key to it, add the context to the player pawn, and print a message on press. Tick each step as you go.
- 1Create an Input Action
In the Content Browser, click 'Add' (or right-click in an empty area) and go to Input → Input Action. Name it something clear like 'IA_Interact'.
Double-click it to open it. The key setting is 'Value Type'. For a simple button press leave it on 'Digital (bool)' — that's the on/off shape you want for a press.
TipPrefix Input Actions with 'IA_' and contexts with 'IMC_'. It keeps them easy to find and matches what the engine templates do.
- 2Create an Input Mapping Context
Back in the Content Browser, Add → Input → Input Mapping Context. Name it 'IMC_Default' (or 'IMC_Player').
Open it. This asset is where you bind keys to actions. Right now it's an empty list — we'll add a mapping next.
TipKeep your Input assets together in a folder like Content/Input so they don't get lost as your project grows.
- 3Map the E key to your action
Inside the open IMC, click the '+' on the 'Mappings' array to add a row. In the new row, pick your action ('IA_Interact') from the dropdown.
Each mapping has its own list of keys. Click the '+' under your action's row, then click the key field and either choose a key from the list or press the E key on your keyboard to capture it. Save the asset.
TipYou can add several keys to the same action — bind both E and a gamepad face button so keyboard and controller players both trigger 'Interact'.
- 4Open your player pawn's Blueprint
Find the Blueprint that represents the player. In the Third Person template it's the character Blueprint (often called BP_ThirdPersonCharacter) under the ThirdPerson/Blueprints folder. Double-click to open it.
This is the Actor the player controls, so it's where we tell Enhanced Input which context is active and where we handle the action.
- 5Add the mapping context when play begins
In the Event Graph, find or add the 'Event BeginPlay' node. From it, we register our context with the local player's Enhanced Input Subsystem.
Drag off BeginPlay and add 'Get Controller' → from that, 'Get Local Player Subsystem' set to 'Enhanced Input Local Player Subsystem'. Drag off that and call 'Add Mapping Context'. Set its 'Mapping Context' pin to your IMC_Default and leave Priority at 0. (The template Blueprint usually already does this — if so, just confirm your IMC is the one being added, or add a second Add Mapping Context node for yours.)
TipAdding a context is what 'turns it on'. No context, no input — this is the single most common reason a new action does nothing.
- 6Handle the action and print a message
Right-click in the Event Graph and search for your action by name — you'll find an event node 'EnhancedInputAction IA_Interact'. Add it. This node fires whenever the player presses E.
Drag off its 'Triggered' execution pin and add a 'Print String' node. Type something like 'Interact pressed!' into its text. That's your whole input handler.
TipThe event node has several output pins (Triggered, Started, Completed). For a simple 'on press' use 'Triggered' — it fires while the action is active.
- 7Compile, save, and Play
Click Compile, then Save. Close the Blueprint and press Play in the main editor.
Press E. Your message should print to the top-left of the screen. Congratulations — you've wired input the real UE5 way.
TipNothing printing? Re-read the warning below — it's almost always the missing mapping context or the wrong execution pin.
Why does Enhanced Input split things into a separate Action and a Context? Couldn't you just say 'when E pressed, do X'?
Separating them is what makes real games maintainable. Your logic only ever cares about the action ('Interact'), never the physical key. That means you can let players rebind keys, support keyboard and gamepad at the same time, and add or change keys without touching a single line of your gameplay graph.
Contexts add a second superpower: you can swap whole control schemes by adding and removing contexts. On foot you have an 'on-foot' context; open a menu and you remove it and add a 'menu' context; the same Interact action can mean different things in each. With a hard-coded 'when E pressed', none of that is possible.
Picking the right Value Type
Use for anything that's on or off: Jump, Fire, Interact, Crouch. The action carries a true/false.
This is the default and the right choice for your first 'press a key' action.
Use for a single sliding value, like an analog trigger (0 to 1) or a 'lean' axis (-1 to 1).
The Triggered event gives you an 'Action Value' you can read as a float.
Use for two-axis input like a thumbstick or WASD movement and mouse look. One action carries an X and a Y.
This is how the template handles Move and Look — a single 'IA_Move' returns a 2D vector you feed into movement. You'll see modifiers (like 'Negate' or 'Swizzle') used on the key mappings to turn individual WASD keys into the right axis.
Optional: the same idea in C++
void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
// Cast to the Enhanced Input component the project uses by default.
if (UEnhancedInputComponent* Input = Cast<UEnhancedInputComponent>(PlayerInputComponent))
{
// InteractAction is a UInputAction* property set in the editor.
Input->BindAction(InteractAction, ETriggerEvent::Triggered, this, &AMyCharacter::OnInteract);
}
} Add a second Input Action, 'IA_Crouch', mapped to the Left Ctrl key. When the player presses it, print 'Crouch!' to the screen — without breaking the Interact action you already made.
Hint 1
Create a new Input Action (Digital bool) and add a new mapping row in the same IMC_Default for it — you don't need a second context.
Hint 2
Map Left Ctrl as the key on that new row, then Save the context.
Hint 3
In the player Blueprint, right-click and search for 'IA_Crouch' to get its event node, then wire its Triggered pin into a new Print String.
Content Browser → Add → Input → Input Action, name it 'IA_Crouch', leave Value Type as Digital (bool). Open IMC_Default, click '+' on Mappings, choose IA_Crouch, add a key and set it to Left Ctrl, then Save.
Open the player Blueprint, right-click in the Event Graph, search 'IA_Crouch', add the 'EnhancedInputAction IA_Crouch' event, drag off its Triggered pin into a new Print String reading 'Crouch!'. Compile, Save, Play, and press Left Ctrl. Because the existing context and Interact event are untouched, both keys now work.
QuizCheck yourself
1What is the job of an Input Mapping Context (IMC)?
The context is the list that maps keys to actions. Adding it to the player activates those bindings; removing it deactivates them.
2You created an Input Action and an event node, but pressing the key does nothing. The most likely cause is…
An Input Action alone is inert. Without the context being added to the local player subsystem, no keys are bound to it, so nothing fires.
3Which Value Type fits a simple on/off button like Jump or Interact?
Digital (bool) is the on/off shape for a button. Axis1D suits a single analog value; Axis2D suits two-axis input like movement or look.
Editor shortcuts that speed this up
- Ctrl S Save the current asset (your IA, IMC, or Blueprint)
- Compile button Compile the open Blueprint (top-left of the Blueprint editor toolbar)
- Alt P Play in the level (test your input)
- Esc Stop Play and return to editing
Mark this lesson complete
We'll remember it on your Academy page and unlock the next lesson below.
Questions beginners ask
Is Enhanced Input the same as the old Action/Axis Mappings in Project Settings?
No — it's the modern replacement. Older UE4 tutorials define Action and Axis Mappings in Project Settings → Input. UE5 uses Enhanced Input instead: assets called Input Actions and Input Mapping Contexts. The new UE5 templates ship with Enhanced Input, so it's what you should learn.
Do I have to use C++? I only know Blueprints.
Blueprints are completely sufficient. You create the Input Action and Mapping Context as assets, then add the context and handle the action entirely in the Event Graph — no code required. The C++ snippet in this lesson is optional, just to show the same idea for those who want it.
Where do I add the mapping context — and why on BeginPlay?
You add it to the local player's Enhanced Input Local Player Subsystem, usually from the player pawn or controller's BeginPlay, so the context is active as soon as the player exists. You can add and remove contexts at any time to switch control schemes (for example, swapping an on-foot context for a menu context).
Can one action be triggered by both a key and a gamepad button?
Yes — that's a core benefit. In the Input Mapping Context, add multiple keys to the same action's mapping (for example E and a gamepad face button). Both then trigger the same action, so your gameplay logic supports keyboard and controller without any extra work.