add_input_trigger
Append Down, Pressed, Released, Hold, Tap, Pulse, or ChordAction triggers to a key mapping or InputAction asset, defining exactly when a key fires its action.
Instructions
Decide WHEN a key fires its action: append a trigger (Down / Pressed / Released / Hold / Tap / Pulse / ChordAction) so a key can mean tap-to-do-X and hold-to-do-Y instead of consuming two keys. Targets either one key mapping inside a mapping context (pass context + key) or, with no context and no key, the InputAction asset's own Triggers array -- the difference decides whether the rule applies to that binding or to the action everywhere, so a key without a context is refused rather than read as the action. The edited asset is saved, and the call succeeds only when it reaches disk. Tune it afterwards with set_input_action_trigger_behavior; list_input_trigger_types enumerates the classes.
Returns: Context target: { context_name, action_name, key, trigger_type, trigger_class, index, trigger_count, saved, save_error? }; Action target: { action_name, action_path, trigger_type, trigger_class, index, trigger_count, saved, save_error? }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | Key name of the mapping the trigger is attached to: required with a context, and refused when there is no context. | |
| key_name | No | Input key name (e.g. SpaceBar, Gamepad_FaceButton_Bottom) | |
| action_name | No | Short asset name of the InputAction. | |
| action_path | No | Asset path of the Input Action | |
| context_name | No | Short asset name of the InputMappingContext. Omit it (and context_path) to append the trigger to the InputAction asset's own Triggers array instead of one of its key mappings. | |
| context_path | No | Asset path of the Input Mapping Context, instead of context_name. | |
| trigger_type | Yes | One of "Down", "Pressed", "Released", "Hold", "Tap", "Pulse", "ChordAction". |