Changing save location for enhanced input user settings

Hi,

We’ve recently received a QA report regarding save game issues when switching Steam user profile. To fix this, I want to change the paths used to actually use per-profile paths. However, I noticed that the Enhanced Input User Settings forces the path used for storing/loading save data:

`UEnhancedInputUserSettings* UEnhancedInputUserSettings::LoadOrCreateSettings(ULocalPlayer* LocalPlayer)
{
UEnhancedInputUserSettings* Settings = nullptr;
// If the save game exists, load it.
if (UGameplayStatics::DoesSaveGameExist(UE::EnhancedInput::SETTINGS_SLOT_NAME, LocalPlayer->GetLocalPlayerIndex()))
{
USaveGame* Slot = UGameplayStatics::LoadGameFromSlot(UE::EnhancedInput::SETTINGS_SLOT_NAME, LocalPlayer->GetLocalPlayerIndex());
// …

void UEnhancedInputUserSettings::SaveSettings()
{
if (ULocalPlayer* OwningPlayer = GetLocalPlayer())
{
UGameplayStatics::SaveGameToSlot(this, UE::EnhancedInput::SETTINGS_SLOT_NAME, OwningPlayer->GetLocalPlayerIndex());
// …`While SaveSettings is virtual and can be overridden, LoadOrCreateSettings is static and will always load from that particular slot regardless of the desired input. Additionally, the loading of these settings isn’t really under our control either. As far as I can tell, the load is done primarily through UEnhancedInputLocalPlayerSubsystem:

`void UEnhancedInputLocalPlayerSubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);

if (GetDefault()->bEnableUserSettings)
{
InitalizeUserSettings();
}
}

void UEnhancedInputLocalPlayerSubsystem::PlayerControllerChanged(APlayerController* NewPlayerController)
{
Super::PlayerControllerChanged(NewPlayerController);

if (GetDefault()->bEnableUserSettings)
{
InitalizeUserSettings();
}
}

void UEnhancedInputLocalPlayerSubsystem::InitalizeUserSettings()
{
ULocalPlayer* LP = GetLocalPlayer();

UserSettings = UEnhancedInputUserSettings::LoadOrCreateSettings(LP);
// …`We have strict policies against modifying Unreal Engine to avoid additional friction when reporting issues, so changing this behavior in the source is not likely to happen.

From what I can tell, SaveGameToSlot (on PC) will always save to a path in the form Saved/SaveGames/<Save name>.sav. While for the save data we do control, we can simply add the user ID to the save game name, resulting in output path Saved/SaveGames/<UserId>/<Save name>.sav, we can’t do this with enhanced input settings for the reasons listed above.

Are there plans on improving this system so that the save path can be controlled? Is there a workaround which doesn’t involve modifying the engine which can be used in the meantime?

Hey there, we have added a way to specify the file name for the save file in 5.6. This is the GitHub commit link which adds it specifically: https://github.com/EpicGames/UnrealEngine/commit/5fe407364c3634cdba940bf494fd7036b5900517

I hope that helps!

Thanks, Ben

Hi,

We’ve integrated the change you spoke of in our version of 5.5, but this triggers a crash in UEnhancedInputUserSettings::GetSaveFilename when booting with bEnableUserSettings enabled in the UEnhancedInputDeveloperSettings.

`FString UEnhancedInputUserSettings::GetSaveFilename(const ULocalPlayer* LP)
{
check(LP);

UEnhancedPlayerInput* PlayerInput = LP->GetSubsystem()->GetPlayerInput();

check(PlayerInput);

return PlayerInput->GetUserSettingsSaveFileName();
}`Did something change between 5.5 and 5.6 that makes this fix work as intended?

I’ve worked around it by disabling the bEnableUserSettings flag in the config files, and re-enabling it when our custom player input class initializes, but this seems like a pretty big issue to just ignore.

Sorry about that, I forgot to link this change as well which fixed that back in January: https://github.com/EpicGames/UnrealEngine/commit/1298867ec0a1f59b8166808bec912520f9829a88

that path is hardcoded as UE::EnhancedInput::SETTING_NAME in UEnhancedInputUserSettings::LoadOrCreateSettings — to get per-Steam-user slots you either subclass PlayerController/LocalPlayer and override the load path, or stop using the engine UserSettings save and back it with your own USaveGame + per-profile slot (e.g. InputSettings_<SteamId>). then on login switch slot and re-apply mappings.

if you dont want to fork that plumbing, advanced enhanced input key remapping Advanced Enhanced Input Key Remapping / Binding / Profiles / Local & Cloud Save. | Fab gives you that out of the box — multi-profile management, local save and Steam/EOS cloud sync with per-user slots and one-click reset, so each Steam profile keeps its own bindings without touching the engine default path.