- Open Settings | Project Settings | Input.
- Go to the Action Mappings heading and click on the + icon beside it:

- Start to type in the actions that should be mapped to button pushes. For example, type in Jump for the first Action.
- Click on the arrow to the left of the action to open up the menu and then select a key to press for that action to occur, for example, Space Bar.
- If you would like the same action triggered by another key push, click on the + beside your Action Mappings name and select another key to trigger the Action.
- If you want the Shift, Ctrl, Alt, or Cmd keys to be held down for the Action to occur, be sure to indicate that in the checkboxes to the right of the key selection box:

- To link your Action to a C++ code function, you need to override the SetupPlayerInputComponent(UInputControl* control ) function. Enter the following code inside that function:
// Called to bind functionality to input
void AWarrior::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
check(PlayerInputComponent);
PlayerInputComponent->BindAxis("Forward", this,
&AWarrior::Forward);
PlayerInputComponent->BindAxis("Back", this, &AWarrior::Back);
PlayerInputComponent->BindAxis("Right", this, &AWarrior::Right);
PlayerInputComponent->BindAxis("Left", this, &AWarrior::Left);
PlayerInputComponent->BindAction("Jump", IE_Pressed, this,
&AWarrior::Jump);
}
- Compile your script and play the game. Whenever you press the spacebar, you should see the player jump in the air! Refer to the following screenshot:
