DataConfig 1.5 & 1.6 with UE 5.4 support

2024-03-31

Intro

We just pushed DataConfig 1.6.0 and 1.5.0 a month prior. Both have some cool features that we'll quickly go through here!

Blueprint Nodes

We now ship DataConfig Blueprint Nodes for dumping/loading JSON! I don't remember why we didn't do this in the first place but having this means that you can start trying out DataConfig without writing C++ code.

Blueprint Nodes

It's bundled with extra samples so you can try play it with Gameplay Tag and Instanced Struct.

Optional Property

Unreal 5.4 introduced optional property that allows you to mark TOptional fields as UPROPERTY:

// DataConfigTests54/Private/DcTestUE54.h
USTRUCT()
struct FDcTestOptional
{
    GENERATED_BODY()

    UPROPERTY() TOptional<float> OptionalFloatField1;
    UPROPERTY() TOptional<float> OptionalFloatField2;

    UPROPERTY() TOptional<FString> OptionalStrField1;
    UPROPERTY() TOptional<FString> OptionalStrField2;

    UPROPERTY() TOptional<FDcInnerStruct54> OptionalStructField1;
    UPROPERTY() TOptional<FDcInnerStruct54> OptionalStructField2;
};

DataConfig fully supports this now and it works perfectly with JSON format since any JSON value can be null:

// DataConfigTests54/Private/DcTestUE54.cpp
FString Str = TEXT(R"(

    {
        "OptionalFloatField1" : 17.5,
        "OptionalFloatField2" : null,

        "OptionalStrField1" : "Alpha",
        "OptionalStrField2" : null,

        "OptionalStructField1" : {
            "StrField" : "Beta",
            "IntField" : 42
        },
        "OptionalStructField2" : null
    }

)");

//  equivalent fixture
FDcTestOptional Expect;
Expect.OptionalFloatField1 = 17.5f;
Expect.OptionalStrField1 = TEXT("Alpha");
Expect.OptionalStructField1.Emplace();
Expect.OptionalStructField1->StrField = TEXT("Beta");
Expect.OptionalStructField1->IntField = 42;

Core Types Serializers

DataConfig now comes bundled with a set of serialization handlers that read/writes core types like FVector into a more compact format:

{
    "VecField1" : [        0,         0,         1],
    "ColorField1" : "#000000FF",
    "DateTimeField1" : "0001.01.01-00.00.00",
}

This works both ways in serialization and deserializations.

Breaking Changes

Both versions now have some breaking changes. They're all documented here.

Closing

Download the latest release here. We'll update DataConfig JSON Asset later when 5.4 is out.