5.4 Config not saving correctly

Since UE 5.4 everything that should be persisted in ini files is not getting saved properly. Load config from the Game.ini seems to work but not saving. I think it has to do with this here missing:

[SectionsToSave]
bCanSaveAllSections=true

I can add it manually and it is working again but i have the same issue with settings not saving in my build game. Is anyone else having the same issues and know how to solve this?

1 Like

Greetings @Zssork

I actually did see someone having similar issues with the DefaultEngine.ini. They ended up deleting it and regenerating a new one and it fixed the problem. I’m not sure if that will work here. But, I’d try it for a start. Let me know if that resolves it. Thanks!

thx, i can test it later but it would be not the best fix for that because we already have a demo released and it would be really bad if now everyone would need to delete the settings.

sadly deleting the config ini files does not solve this issue

In UCLASS(config = SomeName), I added the word “Editor” to “SomeName”, then SaveConfig() worked. Maybe if you add “User”, it will work.

Within my debugging, I found this.

https://github.com/EpicGames/UnrealEngine/blob/16dc333db3d6439c7f2886cf89db8907846c0e8a/Engine/Source/Runtime/Core/Private/Misc/ConfigContext.cpp#L403-L423


		// check if the config file wants to save all sections
		bool bLocalSaveAllSections = false;
		// Do not report the read of SectionsToSave. Some ConfigFiles are reallocated without it, and reporting
		// logs that the section disappeared. But this log is spurious since if the only reason it was read was
		// for the internal save before the FConfigFile is made publicly available.
		const FConfigSection* SectionsToSaveSection = ConfigFile->FindSection(SectionsToSaveString);
		if (SectionsToSaveSection)
		{
			const FConfigValue* Value = SectionsToSaveSection->Find(SaveAllSectionsKey);
			if (Value)
			{
				const FString& ValueStr = UE::ConfigCacheIni::Private::FAccessor::GetValueForWriting(*Value);
				bLocalSaveAllSections = FCString::ToBool(*ValueStr);
			}
		}

		// we can always save all sections of a User config file, Editor* (not Editor.ini tho, that is already handled in the normal method)
		bool bIsUserFile = BaseIniName.Contains(TEXT("User"));
		bool bIsEditorSettingsFile = BaseIniName.Contains(TEXT("Editor")) && BaseIniName != TEXT("Editor");

		ConfigFile->bCanSaveAllSections = bLocalSaveAllSections || bIsUserFile || bIsEditorSettingsFile;

1 Like

thx for the response. I was using Config = Game. I now just added these lines to the DefaultGame.ini and other default files and it seems to work

[SectionsToSave]
bCanSaveAllSections=true

But with the code you showed it makes sense why it wont save it. But tbh its a wierd behaviour and i did not find any documentation or notice from epic about this change

2 Likes

It was hard to believe me to see that code, too. Also, it was hard to believe that the document or notice did not comment on it. But I understand things like this sometimes happen in large organizations. I guess there must have been some unavoidable circumstances.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.