Config Saving/Loading Broken in UE 5.5

Context

Error

When exiting the editor and reopening it, saved config variables in custom configs are not loaded correctly.

Cause

In Unreal Engine 5.5, the config system was modified and it broke some of the expected behaviour.

This seems to be fixed in UE 5.6.

Fix

Manually load the config into memory BEFORE calling LoadConfig() on our object.

void UOS_PST_Settings::LoadFromConfig()
{
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
	//The config system is broken in 5.5, so we have to manually load the config into memory BEFORE calling LoadConfig() on our object
	FString ConfigPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::ProjectSavedDir(), TEXT("Config"), FPlatformProperties::PlatformName(), TEXT("OseroSuiteEditorSettings.ini")));
	// Attempt to load the config file
	GConfig->LoadFile(ConfigPath);
#endif

	LoadConfig();
	//...
}

void UOS_PST_Settings::SaveToConfig()
{
	//...
	SaveConfig();
}

Even when using the UCLASS tag "defaultconfig", the config seems to be saved in the Project > Saved folder, rather than the Config > Saved folder.

Last updated