ActionMappings order different than in Config file

I’m doing some rebinding logic for my plugin, and I came across this annoying problem:

UInputSettings* Settings = const_cast<UInputSettings*>(GetDefault<UInputSettings>());
TArray<FInputActionKeyMapping>& Actions = Settings->ActionMappings;

The Actions array will have all the actions in the Input config file, but they will be sorted alphabetically and not in the order that I specified in the config file itself. Is there a way I can change that?

Thanks in advance!

The problem was that i was later calling Settings->SaveActionMappings(), but that function sorts both the ActionMappings and AxisMappings. To prevent that from happening, call Settings->SaveConfig instead!