InputSettings (Save, Load, ForceRebuild Config)

Hello dear Epic Team,

i wanted to know what the intention is, with SaveConfig, LoadConfig, ForceRebuildingKeyMaps.

I am working on a rebind system for PlayerInput and its working good so far. But i am not able to reset all InputMappings back to DefaultInput.

i am doing something like this (In PlayerController)

void Rebind(some params) { UInputSettings* PCInput = GetMutableDefault();

// …
// do a rebind to a keymapping
// …

// after rebind…
PCInput->SaveConfig(); // gets me a modified ini in “Saved” Folder

this->PlayerInput->ForceRebuildingKeyMaps(true); // Flush the modified Keymapping immediatly
}

void ResetToDefault()
{

// How can i restore all mappings to default here?

}

Maybe i need to LoadConfig (Default.ini) or something but its not working as intended. I think i do not understand some things how the intention of those Funcs are.

I appreciate any help or hints

best regards

did you tried using this?

hmmm, for some reason i have no “reply” or comment button…

Well, i was able to get things to work. Instead of messing around with GetDefault i am using the PlayerInput and InitInputSystem from APlayerController.

Everything works fine. Only when i call SaveConfig i get strange outputs in the Saved input file.

i use the following flow:

/* inside MyControllerclass */

void PostInitComp()
{
// init Input and init PlayerInput var
APlayerController::InitInputSystem()
}

void rebind()
{
TArray<FInputAxisKeyMapping>& Axis = PlayerInput->AxisMappings;
TArray<FInputActionKeyMapping>& Actions = PlayerInput->ActionMappings;

//...
// Rebind anything you want to
// ...

// Save Config after rebind without Sorting, Folder: !!! PROBLEM: it only saves the DebugExecBindings but not the 
// Axis and Actions !!!
PlayerInput->SaveConfig(16384Ui64, L"../../../MyProject/Saved/Config/Windows/CustomInputProfile.ini");
}

void RestoreToDefaults()
{
PlayerInput->ForceRebuildingKeyMaps(true);
}

Everything works as intended but only as long as i stay in Game, since the config ini isnt filled with the axis and action information when i call SaveConfig which is strange.

Any suggestions?

best regards