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?