GameUserSettings are reverted back to original in packaged game on exit

Hi there,

I’m encountering an odd issue with GameUserSettings. The behavior is consistent in the Editor but not in the packaged game.

I’ve created a custom GameUserSettings class with additional fields in C++. Both the Editor and packaged game successfully save these values to the ini file. However, the packaged game consistently reverts the values to their original state after closing the game, even when using ALT F4.

I’ve confirmed that the ini file values are changing correctly while the game is running, but they’re overwritten on exit. Interestingly, if I manually modify the ini file before launching the game, the game correctly reads the new values. This indicates the issue isn’t simply default value restoration.

I’ve checked for relevant packaging settings but haven’t found a solution.

Thanks in advance for any help.

You just need to program the file to have a new name whenever it’s updated, then program the engine to read from the new file name instead.

Sadly not in this case. I am working with the game settings. I dont have control about the file name (at least to my knowledge). I have not seen anything online to suggest otherwise. Everything I found is simply to call the save settings from either blueprint or C++. The save itself works but does not persist between sessions

Found my issue. Turns out I had poorly implemented the game settings. I had instantiated my own inside of the game instance and had things call the game instance. After looking into Lyra a bit more I found that the correct way to implement the game settings is to create a static function in the game settings class itself. I called mine Get(). Then simply implemented as so

UMyGameUserSettings* UMyGameUserSettings::Get()
{
	return GEngine ? CastChecked<UMyGameUserSettings>( GEngine->GetGameUserSettings() ) : nullptr;
}