FStringAssetReference and property marked as Config, how does it work?

I have a property marked with:

class MyClass
{
UPROPERTY(Config, EditAnywhere, Category = Defaults, meta = (AllowedClasses = "MyClass", DisplayName = "My Class Ptr"))
FStringAssetRefrence Ref;
};

I can define a default for this property in the DefaultEditor.ini

as

/Script/MyModule.MyClass
Ref=/Game/MyData.MyData

Am I correct in saying that:

  • For new objects the default value is obtained through the ini file.

  • I can change the value after creation and my new value persists for the instance of the asset I modified?

Also, if there are assets of this type that already exist, but I then just added this property, do all the existing assets take on the default value or will it be empty?

Thanks.

Hi Kevin,

Config values will be used as defaults, yes. Changing a config value to a new value will only affect instances which were saved with the property at the previous value.

The property value for an instance is basically not saved out if is the same as the current default. This means that you can have the following:

Step 1 - setup
--------------
// Config.Prop == 1
Instance.Prop = 3;
Save(Instance); // Instance.Prop gets saved as 3

Step 2 - change Config.Prop to 2
--------------------------------
Load(Instance); // Instance.Prop == 3
Save(Instance); // Instance.Prop gets saved as 3

Step 3 - change Config.Prop to 3
--------------------------------
Load(Instance); // Instance.Prop == 3
Save(Instance); // Instance.Prop *does not get saved* because it now matches the default

Step 4 - change Config.Prop to 4
--------------------------------
Load(Instance); // Instance.Prop == 4, because it wasn't saved last time

Hope this is clear,

Steve