An overview of how to set up player mappable keys for your game using Enhanced Input.
https://dev.epicgames.com/community/learning/tutorials/Vp69/unreal-engine-player-mappable-keys-using-enhanced-input
This was very helpful. Thank you!
Thank you for the tutorial @BenjaFriend22!
Iām trying to utilize the slot feature in my input settings menu and seem to have hit a barrier. I canāt set default keys for secondary movement mappings. In the first picture of the tutorial, it looks like Fortnight has the arrow keys as the default secondary mappings for movement. Are they set in an Input Mapping Context?
Lyraās Melee binding in ShooterCore utilizes the Second slot for the secondary binding of āEā:
āEā is set as the default secondary key in IMC_ShooterGame by inheriting the Player Mappable Key Settings from IA_Melee:
DumpProfileToLog() shows the following:
Melee
Mapping Name: āMeleeā Slot: āFirstā Default Key: āCā Player Mapped Key: āCā HardwareDevice: āNone::Noneā AssociatedInputAction: āIA_Meleeā
Mapping Name: āMeleeā Slot: 'Secondā Default Key: āEā Player Mapped Key: āEā HardwareDevice: āNone::Noneā AssociatedInputAction: āIA_Meleeā
Under the hood of IMC_ShooterGame, there are two instances of Player Mappable Key Settings with the same Name property, in this case itās āMeleeā.
At some point the first one gets set to Slot āFirstā and the second to Slot āSecondā. Unfortunately, there is a validator which prevents the same Name property from being given to multiple Player Mappable Key Settings in a Input Mapping Context when overriding whatās in the Input Action:
The validator is FEnhancedInputPlayerMappableNameValidator::IsValid() and it prevents the user from inputting text too long to fit in an FName as well as a Name which is already in use. Should the check for already in use be removed? Instead it could ensure there are enough slots for all instances of the Name. EPlayerMappableKeySlot has a max of seven slots, but there is a code comment in the enum suggesting the max is defined in a project setting.
If Iām on the wrong track, is there another method to define default mappings for additional slots I havenāt figured out yet?
Did you ever figure out of it?
Add
[ConsoleVariables]
EnhancedInput.bEnableNameValidation=0
To your DefaultEngine.ini, or just set the var in your console in-editor.
Disclaimer - donāt hold me responsible if anything breaks lol. This allowed me to use the same Name across multiple IMCās, and in addition, the behavior was as anticipated - changes to āForwardā in one IMC propagated to another IMC where āForwardā Name was also used