proposed fix seems ok to me:
UEnhancedInputUserSettings* UEnhancedInputUserSettings::LoadOrCreateSettings(ULocalPlayer* LocalPlayer) { UEnhancedInputUserSettings* Settings = nullptr; if (!LocalPlayer) { UE_LOG(LogEnhancedInput, Log, TEXT("Unable to determine an owning Local Player for the given Enhanced Player Input object")); return 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()); Settings = Cast<UEnhancedInputUserSettings>(Slot); } // If there is no settings save game object, then we can create on // based on the class type set in the developer settings // <#Engine_Mod> // // Previous code: // if (Settings == nullptr) // { // const UEnhancedInputDeveloperSettings* DevSettings = GetDefault<UEnhancedInputDeveloperSettings>(); // UClass* SettingsClass = DevSettings->UserSettingsClass ? DevSettings->UserSettingsClass.Get() : UEnhancedInputDeveloperSettings::StaticClass(); // // Settings = Cast<UEnhancedInputUserSettings>(UGameplayStatics::CreateSaveGameObject(SettingsClass)); // } const UEnhancedInputDeveloperSettings* DevSettings = GetDefault<UEnhancedInputDeveloperSettings>(); UClass* SettingsClass = DevSettings->UserSettingsClass ? DevSettings->UserSettingsClass.Get() : UEnhancedInputDeveloperSettings::StaticClass(); if (Settings == nullptr || !Settings->IsA(SettingsClass)) { // </#Engine_Mod> Settings = Cast<UEnhancedInputUserSettings>(UGameplayStatics::CreateSaveGameObject(SettingsClass)); } if (ensure(Settings)) { Settings->Initialize(LocalPlayer); Settings->ApplySettings(); } return Settings; }
Result: it fails to load the settings because the class has changed
expected: We gracefully handle the changing of settings classes without forcing people to delete the settings manually out of the saved folder
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-216386 in the post.
0 |
Component | UE - Gameplay - Input |
---|---|
Affects Versions | 5.3 |
Target Fix | 5.5 |
Fix Commit | 34286832 |
---|
Created | Jun 3, 2024 |
---|---|
Resolved | Jun 11, 2024 |
Updated | Jul 3, 2024 |