Create Input Action #
Create the Input Actions required for your interactions (movement, camera, character Action like jump, fire, etc). Select the value type accordingly. Bool for button, Axis2D for joystick and touch region.
![](https://www.lostingamestudio.com/wp-content/uploads/2024/04/Bool.png)
![](https://www.lostingamestudio.com/wp-content/uploads/2024/04/Axis2D.png)
![](https://www.lostingamestudio.com/wp-content/uploads/2024/04/InputActions.png)
Create Input Action Mapping #
Add all created input actions to Input Mapping Context and assign gamepad or mouse/keyboard key. I recommend using gamepad key.
![](https://www.lostingamestudio.com/wp-content/uploads/2024/04/InputMappingContext-1024x453.png)
Touch Interface #
Create the virtual input required for your interactions (movement, camera, character Action like jump, fire, etc). Fill the accordingly input action.
![](https://www.lostingamestudio.com/wp-content/uploads/2024/04/JoystickOverview-1024x576.png)
Character C++ #
Begin Play #
In Begin play function, add mapping context. You need to create a UInputMappingContext* variable and expose it to Blueprint.
![](https://www.lostingamestudio.com/wp-content/uploads/2024/04/AddMappingContextC.png)
Setup Player Input Component #
Bind Actions to appropriate function in setup player input component
![](https://www.lostingamestudio.com/wp-content/uploads/2024/04/SetupPlayerInput.png)
Functions #
In HandleMove function for example, get the action value and do something with it!
- ActionValue.Get<FVector2D> for Axis2D
- ActionValue.Get<bool> for Bool
![](https://www.lostingamestudio.com/wp-content/uploads/2024/04/MoveFunction.png)