Array Uproperty config not load with ini content in package

Hi all,
I’ve this problem, an UObject with an array member marked as config that is correctly initialized when game is played in editor. When I package the game and execute, the uobject array has always the elements that is written in the default config ini, completely ignoring the new entry written in the new package ini. This is strange because any other members different from an array, the package config ini values are loaded correctly.

Here is the object read in the config:

UCLASS(config=MyGameSetting)
class MY_GAME_API UMyGameSettings : public UObject
{
	GENERATED_BODY()

public:
	UMyGameSettings () {};

	UPROPERTY(Config,BlueprintReadWrite, EditAnywhere)
	TArray<FString> Connections;

	UPROPERTY(Config, BlueprintReadWrite, EditAnywhere)
	FString connection1;
};

Here DefaultMyGameSetting.ini with default config that is loaded also on package

[/Script/MYGameModule.MyGameSettings]
+connection="string1"
+connection="string2"
connection1="default1"

Here MyGameSetting.ini that is placed in the package

[/Script/MYGameModule.MyGameSettings]
+connection="stringNEW"
+connection="stringNEW2"
connection1="default2"

I’ve tried also using - . + ! as explained in Configuration Files | Unreal Engine Documentation but nothing worked.

The UMyGameSettings object is create in an actor constructor with this instructions:

settings = CreateDefaultSubobject<UMyGameSettings >(TEXT("SettingsObject"));

So repeating, executing the game with editor (or standalone with -game) load correctly the settings specified in DefaultMyGameSetting.ini.
Packaging and executing the package, load the array as specified in DefaultMyGameSetting.ini (at packaging time) and only the member connection1 as written in MyGameSetting.ini.

For now I’ve found a workaround by simply using a fixed number of plain Strings, but I would like to have this working as an array.
How could I resolve the issue?

Hey Mauxx91,

To be clear, are you replacing DefaultMyGameSetting.ini with MyGameSetting.ini?

What folder is DefaultMyGameSetting.ini located in within the packaged project?

Why not store the values in MyGameSetting.ini that is created to begin with and then just alter those values as needed?

Thanks

DefaultMyGameSetting.ini is located under Config folder, on project folder. It is not present in the packaged game. In the packaged game is present the file MyGameSetting.ini and there is where I add my config, I already do as you suggested and it works only for the not array variables.

Okay, I’ve figured it out.

Here’s what I did:

  1. In the project’s Config folder, created DefaultMyGameSetting.ini and added the following to it:

    [/Script/ArrayConfig.MyGameSettings]
    +Connections=“String1”
    +Connections=“String2”
    +Connections=“String3”
    connection1=“defaultString1”

ArrayConfig being my project name in this case.

  1. Packaged the game for Win64.

  2. Open WindowsNoEditor and run the .exe to generate the Config file.

  3. Navigate to WindowsNoEditor->ProjectName->Saved->Config and open MyGameSetting.ini and add the following:

    [/Script/ArrayConfig.MyGameSettings]
    Connections=newString1
    Connections=newString2
    Connections=newString3
    connection1=newString1

What I think was happening was that you were attempting to replace the element using the + sign. I just tried to override the value using Connections rather than +Connections. Using this method worked for both the array and the string variable.

Have a great day