Table of Contents

Class InputMap

A singleton that manages all InputEventActions.

Inheritance
InputMap

Remarks

Manages all InputEventAction which can be created/modified from the project settings menu Project > Project Settings > Input Map or in code with InputMap.add_action and InputMap.action_add_event. See Node._input.

See Also

Methods

action_add_event(StringName, InputEvent)

Adds an InputEvent to an action. This InputEvent will trigger the action.

void action_add_event(StringName action, InputEvent event)

Parameters

action StringName
event InputEvent

action_erase_event(StringName, InputEvent)

Removes an InputEvent from an action.

void action_erase_event(StringName action, InputEvent event)

Parameters

action StringName
event InputEvent

action_erase_events(StringName)

Removes all events from an action.

void action_erase_events(StringName action)

Parameters

action StringName

action_get_deadzone(StringName)

Returns a deadzone value for the action.

float action_get_deadzone(StringName action)

Parameters

action StringName

action_get_events(StringName)

Returns an array of InputEvents associated with a given action.

Note: When used in the editor (e.g. a tool script or EditorPlugin), this method will return events for the editor action. If you want to access your project's input binds from the editor, read the input/* settings from ProjectSettings.

InputEvent[] action_get_events(StringName action)

Parameters

action StringName

action_has_event(StringName, InputEvent)

Returns true if the action has the given InputEvent associated with it.

bool action_has_event(StringName action, InputEvent event)

Parameters

action StringName
event InputEvent

action_set_deadzone(StringName, float)

Sets a deadzone value for the action.

void action_set_deadzone(StringName action, float deadzone)

Parameters

action StringName
deadzone float

add_action(StringName, float)

Adds an empty action to the InputMap with a configurable deadzone.

An InputEvent can then be added to this action with InputMap.action_add_event.

void add_action(StringName action, float deadzone)

Parameters

action StringName
deadzone float

erase_action(StringName)

Removes an action from the InputMap.

void erase_action(StringName action)

Parameters

action StringName

event_is_action(InputEvent, StringName, bool)

Qualifiers: const

Returns true if the given event is part of an existing action. This method ignores keyboard modifiers if the given InputEvent is not pressed (for proper release detection). See InputMap.action_has_event if you don't want this behavior.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.

bool event_is_action(InputEvent event, StringName action, bool exact_match)

Parameters

event InputEvent
action StringName
exact_match bool

get_actions

Returns an array of all actions in the InputMap.

StringName[] get_actions

has_action(StringName)

Qualifiers: const

Returns true if the InputMap has a registered action with the given name.

bool has_action(StringName action)

Parameters

action StringName

load_from_project_settings

Clears all InputEventAction in the InputMap and load it anew from ProjectSettings.

void load_from_project_settings