I'm using the Input Mapping example to save and load buttons. But I'm having trouble saving values for gamepads.
func load_config():
var config = ConfigFile.new()
var err = config.load(CONFIG_FILE)
if err: #Assuming that options.cfg doesn't exist.
for action_name in INPUT_ACTIONS:
var action_list = InputMap.get_action_list(action_name)
#Since there are two control types, get data for both.
var keyboard = OS.get_scancode_string(action_list[0].scancode)
var gamepad = OS.get_scancode_string(action_list[1].scancode)
config.set_value('input', action_name, keyboard)
config.set_value('input', action_name, gamepad)
config.save(CONFIG_FILE)
Using the above gives me an error "Invalid get index 'scancode' (on base: 'InputEventJoyButton')"
Read up about this in the docs, but can't quite to get it working. Saving keyboard keys works just fine.