input
Author Enhanced Input assets: Input Actions and Input Mapping Contexts.
What it’s for
This namespace authors Unreal's Enhanced Input assets. An Input Action (an IA
asset) describes an abstract intent like Jump, Fire, or Look. An Input Mapping Context (an
IMC asset) binds hardware keys to those actions at a given priority. Your assistant
creates these assets, binds keys, and inspects the result without you clicking through the editor.
A typical setup is one Input Action per action, one Input Mapping Context per gameplay mode, then
one key binding per (context, action, key) triple. You would reach for this when you
are standing up a new control scheme, adding a key to an existing one, or checking what an asset
currently binds before you change it.
This namespace only authors the assets. Activating a mapping context at runtime happens in
gameplay Blueprints or C++ through the Enhanced Input local-player subsystem, not here. For the
widget side of an input loop, use ui; to fire runtime input during play, use
editor.console_command.
Examples
Create an Input Action and a mapping context
Start a new control scheme by creating the abstract action and the context that will hold its bindings.
You: Set up a Jump action and a default mapping context under /Game/Input.
call("input.create_input_action", {name:"IA_Jump", path:"/Game/Input"})
→ {ok:true, path:"/Game/Input/IA_Jump.IA_Jump"}
call("input.create_input_mapping_context", {name:"IMC_Default", path:"/Game/Input"})
→ {ok:true, path:"/Game/Input/IMC_Default.IMC_Default"}
Done. Created IA_Jump and IMC_Default under /Game/Input.
Bind keys to an action
Map hardware keys to the action inside the context. Call once per key to bind several keys to the same action.
You: In IMC_Default, bind Space and gamepad A to jump.
call("input.add_mapping", {contextPath:"/Game/Input/IMC_Default.IMC_Default",
actionPath:"/Game/Input/IA_Jump.IA_Jump", key:"SpaceBar"})
→ {ok:true}
call("input.add_mapping", {contextPath:"/Game/Input/IMC_Default.IMC_Default",
actionPath:"/Game/Input/IA_Jump.IA_Jump", key:"Gamepad_FaceButton_Bottom"})
→ {ok:true}
Done. Space and gamepad A both trigger IA_Jump in IMC_Default.
Check what an asset binds
Inspect an Input Action or mapping context to confirm its state without opening the editor.
You: How many mappings does IMC_Default have, and what value type is IA_Jump?
call("input.get_input_info", {assetPath:"/Game/Input/IMC_Default.IMC_Default"})
→ {mappingCount:2}
call("input.get_input_info", {assetPath:"/Game/Input/IA_Jump.IA_Jump"})
→ {valueType:"Digital", bConsumeInput:true}
Done. IMC_Default holds 2 mappings; IA_Jump is a Digital action.