5.4 Config not saving correctly

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;

4 Likes