How do you rebind controls in game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By batmanasb
:warning: Old Version Published before Godot 3 was released.

Normally I use actions for inputs from the user, but what if the user wants to rebind their controls in game (like in most PC games)? How would I go about setting that up?

If @umfk’s answer was correct, consider marking it as such.

Bojidar Marinov | 2016-02-27 12:50

:bust_in_silhouette: Reply From: umfk

If you download the official demo folder you fill find a demo called input_mapping in the folder gui. It has a small example for how to do this.

:bust_in_silhouette: Reply From: nightblade9

You can find the input_mapping Godot demo project here, and the relevant code from here for the function remap_action_to(event):

InputMap.action_erase_events(action)
InputMap.action_add_event(action, event)