Key mapping: Revert to Default Keys

I’m trying to figure out the right way to implement a “Revert to Defaults” feature in my “change key mappings”-UI.
I found and read [this post][1], but I am still not sure what the right approach for this is.

I notice there are already two input config files, one Input.ini located in the Save folder and the DefaultInput.ini.
With the system I have set up now (when playing in the editor) it looks like the Input.ini is the only one changing when I remap keys. Would it be possible to load the keys set in DefaultInput.ini and use these as defaults?

Have a great day!

In general we don’t recommend modifying the input settings directly for remapping. I’m copy/pasting a response I made on a similar question that was marked private that is basically about the same issue:

The approach that Fortnite has taken and I believe is probably a reasonable model is to use the Project Settings as your defaults. Then within your game’s saved user settings store a list of modified input settings.

Whenever a setting is changed or the Player Controller initializes its input system, the modified settings are applied to the Player Input object such that the old mappings are removed and the new mappings added. To reset to defaults simply throw away the user’s modified bindings list.

It is always important to remember to call ForceRebuildingKeyMaps on the PlayerInput after any changes are made to its view of the Action or Axis Bindings.

1 Like

Curiosity, why don’t you recommend modifying the input settings?

The default Input settings sure, but the input ones I don’t understand why.

Since everything seems to work around input settings.

Primarily for 2 reasons:

  1. We think of the input settings as the defaults. As you’ve found if you manipulate those values, the ini settings that go in to the Saved folder make it difficult to revert back to defaults.

  2. If you manipulated the input settings directly it would make having separate configurations for different users difficult.

Ok. We thought DefaultInput to be the defaults