On the main menu level of my game, i have a settings menu where you can input a sensitivity, click save, and it saves it using the following function in my game instance cpp file:
void UDefaultGameInstance::SaveSettings()
{
if (UDefaultStatSaveGame* SaveGameInstance = Cast<UDefaultStatSaveGame>(UGameplayStatics::CreateSaveGameObject(UDefaultStatSaveGame::StaticClass())))
{
SaveGameInstance->Sensitivity = Sensitivity;
if (UGameplayStatics::SaveGameToSlot(SaveGameInstance, TEXT("MySlot"), 0))
{
UE_LOG(LogTemp, Warning, TEXT("Save Game Succeeded."));
}
}
}
If I quit the game from the main menu, it correctly saves my sensitivity and loads it up when I go to change it again inside the settings.
If I select a game mode to play within my main menu, it switches levels and carries with it the user input sensitivity. It also carries back into the main menu if I switch back to the main menu after switching the sensitivity inside the game mode level.
However, if I ever switch levels from my main menu level, nothing is ever loaded correctly after I exit the game. It seems like switching levels is the cause, but I have no idea what could actually be causing it. Any ideas?