InputBindings Save Running Config in StartUpConfig

Hello guys,

i am building a rebind system for input and i am having troubles, that the changes i do during gameplay are lost when closing the game.

Here is a code snippet of what i am doing inside my Controller Class (Actionmapping rebind example):

EDIT: In PostInitComp() i do the following for PlayerInput


APlayerController::InitInputSystem();


for (FInputActionKeyMapping& EachAction : PlayerInput->ActionMappings)
		{
			// compare ActionMapping Keys with the selected Actionname in UI param
			if (EachAction.ActionName == InputName)
			{
				// replace old Key with new Key
				EachAction.Key = inNewKey;				
				
				// Save Changes in Saved/Config/Windows/Input.ini
				PlayerInput->SaveConfig();
				
				// Flush Rebuild. false-> dont restore to default
				  PlayerInput->ForceRebuildingKeyMaps(false);
				
				// Rebuild List for Blueprints/UMG
				OutAllActionMappings(ActionMappingList);

				return true;
			}
		}


However, this is working quite well as long as i stay in editor. Closing the game will discard all my changes and
on restart the old input bindings are loaded.

I think it has something to do with the config hierarchy but i dont want to mess around with GetDefault or even GetMutableDefault like
Rama is presenting in his Tutorial. *EDIT: But i really dont want to say he is doing it wrong or something, without his Tutorials and i wouldnt be
at the point where i am that fast :wink:
*
I also noticed that after saving, the Input.ini only hold info about DebugExecBindings like F1-12 and so on but no Action or Axis Mappings.

Any suggestions?

best regards

Hi, I’m having same troubles.
If I use “PlayerInput->UpdateDefaultConfigFile();” it saves only debug key bindigs.
Did you manage to resolve this?

In source code I found this in UPlayerInput class:



UPROPERTY(config)
TArray<struct FKeyBind> DebugExecBindings;

/** This player's version of the Axis Properties */
TArray<struct FInputAxisConfigEntry> AxisConfig;

/** This player's version of the Action Mappings */
TArray<struct FInputActionKeyMapping> ActionMappings;

/** This player's version of Axis Mappings */
TArray<struct FInputAxisKeyMapping> AxisMappings;


So to resolve this You can create custom class to save bindigs to config, or add UPROPERTY(config) in UPlayerInput to AxisMappings and ActionMappings.