Table of Contents

Class InputMapInstance

Namespace
Godot
Assembly
GodotSharp.dll

Manages all InputEventAction which can be created/modified from the project settings menu Project > Project Settings > Input Map or in code with AddAction(StringName, float) and ActionAddEvent(StringName, InputEvent). See _Input(InputEvent).

[GodotClassName("InputMap")]
public class InputMapInstance : GodotObject, IDisposable
Inheritance
InputMapInstance
Implements
Inherited Members

Methods

ActionAddEvent(StringName, InputEvent)

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

public void ActionAddEvent(StringName action, InputEvent @event)

Parameters

action StringName
event InputEvent

ActionEraseEvent(StringName, InputEvent)

Removes an InputEvent from an action.

public void ActionEraseEvent(StringName action, InputEvent @event)

Parameters

action StringName
event InputEvent

ActionEraseEvents(StringName)

Removes all events from an action.

public void ActionEraseEvents(StringName action)

Parameters

action StringName

ActionGetDeadzone(StringName)

Returns a deadzone value for the action.

public float ActionGetDeadzone(StringName action)

Parameters

action StringName

Returns

float

ActionGetEvents(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.

public Array<InputEvent> ActionGetEvents(StringName action)

Parameters

action StringName

Returns

Array<InputEvent>

ActionHasEvent(StringName, InputEvent)

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

public bool ActionHasEvent(StringName action, InputEvent @event)

Parameters

action StringName
event InputEvent

Returns

bool

ActionSetDeadzone(StringName, float)

Sets a deadzone value for the action.

public void ActionSetDeadzone(StringName action, float deadzone)

Parameters

action StringName
deadzone float

AddAction(StringName, float)

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

An InputEvent can then be added to this action with ActionAddEvent(StringName, InputEvent).

public void AddAction(StringName action, float deadzone = 0.5)

Parameters

action StringName
deadzone float

EraseAction(StringName)

Removes an action from the InputMap.

public void EraseAction(StringName action)

Parameters

action StringName

EventIsAction(InputEvent, StringName, bool)

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 ActionHasEvent(StringName, InputEvent) if you don't want this behavior.

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

public bool EventIsAction(InputEvent @event, StringName action, bool exactMatch = false)

Parameters

event InputEvent
action StringName
exactMatch bool

Returns

bool

GetActions()

Returns an array of all actions in the InputMap.

public Array<StringName> GetActions()

Returns

Array<StringName>

HasAction(StringName)

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

public bool HasAction(StringName action)

Parameters

action StringName

Returns

bool

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

LoadFromProjectSettings()

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

public void LoadFromProjectSettings()