setup-input
Configure the Enhanced Input system with Input Actions, Mapping Contexts, Modifiers, and Triggers via native MCP tools.
Files1
View on GitHubSKILL.mdUnrealEngine/skills/setup-input/SKILL.md
GitHubSkill: Setup Enhanced Input
Description
Configure the Enhanced Input system with Input Actions, Mapping Contexts, key mapping Modifiers, and Triggers.
Arguments
- {{arg}}: The action name to set up (e.g., Jump, Sprint, Interact, Move)
Steps
Create Input Action Asset: Use the
create_input_actionMCP tool to create/Game/Input/Actions/IA_{{arg}}:{ "PackagePath": "/Game/Input/Actions", "ActionName": "IA_{{arg}}", "ValueType": "Digital" }(Supported
ValueTypeoptions:Digital,Axis1D,Axis2D,Axis3D)Add Key Mapping to Input Mapping Context:
- If
/Game/Input/IMC_Defaultdoes not exist, create it viacreate_input_mapping_context:{ "PackagePath": "/Game/Input", "ContextName": "IMC_Default" } - Bind the target key mapping using
add_input_mapping:{ "ContextAsset": "/Game/Input/IMC_Default", "InputActionAsset": "/Game/Input/Actions/IA_{{arg}}", "Key": "SpaceBar" }
- If
Configure Key Mapping Modifiers & Triggers: Attach key modifiers (e.g.
Negate,SwizzleAxis) and trigger conditions (e.g.Pressed,Hold,Tap) usingconfigure_input_mapping_modifiers_triggers:- Example 1: Axis Negation (e.g. Move Backward 'S' key):
{ "ContextAsset": "/Game/Input/IMC_Default", "InputActionAsset": "/Game/Input/Actions/IA_Move", "Key": "S", "Modifiers": [ { "Type": "Negate" } ] } - Example 2: 2D Vector Swizzle (e.g. Move Forward 'W' key):
{ "ContextAsset": "/Game/Input/IMC_Default", "InputActionAsset": "/Game/Input/Actions/IA_Move", "Key": "W", "Modifiers": [ { "Type": "SwizzleAxis", "Order": "YXZ" } ] } - Example 3: Hold Trigger (e.g. Charge Attack / Sprint Hold):
{ "ContextAsset": "/Game/Input/IMC_Default", "InputActionAsset": "/Game/Input/Actions/IA_Sprint", "Key": "LeftShift", "Triggers": [ { "Type": "Hold", "HoldTimeThreshold": 0.5, "bIsOneShot": true } ] }
- Example 1: Axis Negation (e.g. Move Backward 'S' key):
In the character/pawn header, add:
UPROPERTY(EditDefaultsOnly, Category="Input") TObjectPtr<UInputAction> {{arg}}Action; void Handle{{arg}}(const FInputActionValue& Value);In the character/pawn class, override
SetupPlayerInputComponentto bind the action:// Header virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; // Source void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) { Super::SetupPlayerInputComponent(PlayerInputComponent); if (UEnhancedInputComponent* EIC = Cast<UEnhancedInputComponent>(PlayerInputComponent)) { EIC->BindAction({{arg}}Action, ETriggerEvent::Triggered, this, &AMyCharacter::Handle{{arg}}); } }Implement the handler function in C++:
void AMyCharacter::Handle{{arg}}(const FInputActionValue& Value) { // Retrieve input value (e.g. float or Vector2D depending on configuration) // float AxisValue = Value.Get<float>(); }Blueprint Binding Alternative:
- In a Blueprint Character graph, right-click and search for
"EnhancedAction IA_{{arg}}". - Add the Enhanced Action IA_{{arg}} node.
- Wire your game logic nodes to the Triggered or Started / Completed pins.
- In a Blueprint Character graph, right-click and search for
Notes
- Ensure
"EnhancedInput"is added toPublicDependencyModuleNamesin the project's.Build.csfile. - Include
EnhancedInput/Public/EnhancedInputComponent.h. - The project must have the EnhancedInput plugin enabled.
- Python API Tip (UE 5.8): When mapping keys via Unreal Python, instantiate
unreal.Key()withkey.set_editor_property('key_name', 'Space'), constructmapping = unreal.EnhancedActionKeyMapping(), setactionandkey, and appendmappingtoimc.get_editor_property('mappings')before callingunreal.EditorAssetLibrary.save_loaded_asset(imc).