I have a 5.3/5.4 plugin that I’m trying to add 5.5 support to. I’m encountering an issue when reading config settings from the saved directory. When spawning an instance of the settings object, the members are all set to empty. In 5.3/5.4, they would be populated from the INI file.
My settings file is a UObject with some public data:
UCLASS(Config = MyPlugin)
class MYPLUGIN UCharacterSettings : public UObject
{
GENERATED_BODY()
public:
#if WITH_EDITOR
// Called when a property on this object has been modified externally
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
#endif
// The path of the last used Character file
UPROPERTY(Config)
FString CharacterFilePath;
}
I create a default instance of this whenever it is needed. The data is then read/modified, and re-saved. Strangely, in 5.5, the initial values are empty, but once they are set and saved, it does update the INI file correctly. It also retains the edited information when read later. Once the editor is restarted, it is all empty again.
// Get the currently stored settings
UCharacterSettings* CharacterSettings = GetMutableDefault<UCharacterSettings>();
// Do some stuff
// Save changes
CharacterSettings->SaveConfig();
I’ve also tried using the GetIni command, to read the data directly from the file. Prior to editing the settings data, it will also return empty. Once the data has been edited and saved, it does return the correct values until the editor is restarted.
I have tried manually calling LoadConfig() on the instance prior to reading from it, however this does not appear to make any difference. The file name appears to be correct when saving, so I don’t think it fails to load for that reason.
Does anyone have an idea about what may be causing this?