x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 https://docs.unrealengine.com/latest/INT/Programming/Basics/ConfigurationFiles/index.html 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?

Product Version: UE 4.12
Tags:
more ▼

asked Mar 29 '17 at 04:17 PM in Packaging & Deployment

avatar image

Mauxx91
26 1 2 5

avatar image Sean L ♦♦ STAFF Mar 31 '17 at 05:36 PM

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

avatar image Mauxx91 Apr 03 '17 at 08:25 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Apr 03 '17 at 12:28 PM

avatar image

Sean L ♦♦ STAFF
43.7k 485 152 440

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question