I have a series of USTRUCTS. Two USTRUCTS share the same pattern of attributes, so rather than re-creating those attributes in multiple USTRUCTS, I’ve split the shared attributes into its own USTRUCT and reference it by the parent structs. Take this example:
USTRUCT()
struct FCarAttributes
{
UPROPERTY(EditDefaultsOnly, Category="Attributes")
int32 NumberOfSeats; // Watch out, I've got the 8-seater upgrade.
UPROPERTY(EditDefaultsOnly, Category="Attributes")
int32 NumberOfWheels; // Holy smokes, a 5 wheel car?
// and so on ...
}
/** Structure of the available cars, and their properties */
USTRUCT()
struct FCarData : public FTableRowBase
{
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="CarStuff")
FText FriendlyName;
UPROPERTY(EditDefaultsOnly, Category="CarStuff")
FCarAttributes Attributes;
}
/** structure of available upgrades */
USTRUCT()
struct FCarUpgradeData: public FTableRowBase
{
/** Name of the upgrade */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="CarStuff")
FText FriendlyName;
/** Which attribute(s) will this upgrade increase (or alternatively, decrease)? */
UPROPERTY(EditDefaultsOnly, Category="CarStuff")
FCarAttributes Attributes;
}
All of this works great, up until the point of defining the Attributes field in the CSV file used for loading.
This works great:
Name,FriendlyName,Attributes
cg_car_0001,Super Fast Car Ultimate,(NumberOfSeats=9)
This, however, does not:
Name,FriendlyName,Attributes
cg_car_0001,Super Fast Car Ultimate,"(NumberOfSeats=9,NumberOfWheels=4)"
Nor has any other combination of things - I can’t see to figure out how to serialize the USTRUCT to store in the csv. Is there a special delimiter used in the separation of the struct fields within the Attributes field?
I initially created my CSV by hand with notepad, but then went on used an actual spreadsheet program to create the csv for me, in hopes that I was doing it wrong - but alas, my CSV file was fine.
Any help is appreciated!