I’m having some trouble trying to rebind keys with the new Enhanced Inputs system. It just seams to be missing key settings. I’m trying to rebind a key to an action by using Unmap Key to remove the old mapping and then Map Key to map the new mapping to the action.
The problem I’m having is when using Map Key node its missing important key input settings, like the Is Player Mappable, Player Mappable Key Options, Triggers, Modifiers etc. The weird things is the Map Key node then returns a KeyMapping struct that contains all this info but its just blank. Which means I lose my Display Name for the input as well as modifiers for the new input.
I’ve also tried the Add Player Mapped Key node which does work better as it allows you to replace a key input instead of having to remove one and adding a new one. But it doesn’t save to the context, so as soon as you restart the game the controls will revert back to their previous settings. Is there a way to save these new mapped key inputs?
EDIT: So I’ve found that even when using the Map Key node with the Mapping Context object after restarting the engine the Mapping Context blueprint will revert to the previous key input mappings. So I have no idea how your meant to implement a rebind key system that saves the new key inputs.
Be sure to get the mappings array element as a reference (not a copy) otherwise it won’t update the mapping.
The KeyMapping variable is a reference to the mapping we’re trying to change & the MappingContext variable is a reference to the input context that contains the KeyMapping.
Hey, yeah I came up with something similar but still had the issue of the keys reverting after reopening the project, I reported this to Epic and they’ve added the bug to the unreal bug tracker.
I ended up creating a save system using the unreal engine save system that stores the name and key of each binding that gets rebound by the player, then on begin play of the game instance I load that save file and reapply the key binds and this seams to work fine. Not sure if this is the correct way to do this but it does work.