Hello,
I’m trying to serialize a very simple struct, but I’m guessing UE4’s preproccessor scripts are borking this.
My struct:
USTRUCT(BlueprintType)
struct FInventoryItemEntry : public FOnlineJsonSerializable
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Inventory")
FString ItemId;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Inventory")
int32 Quantity;
FInventoryItemEntry() { }
FInventoryItemEntry(FString id)
{
ItemId = id;
Quantity = 1;
}
FInventoryItemEntry(FString id, int32 count)
{
ItemId = id;
Quantity = count;
}
BEGIN_ONLINE_JSON_SERIALIZER_FLAT
ONLINE_JSON_SERIALIZE("ItemId", ItemId);
ONLINE_JSON_SERIALIZE("Quantity", Quantity);
END_ONLINE_JSON_SERIALIZER_FLAT
};
My compilation error:
Inventory.h(59): error : In Inventory: 'struct': Can't find struct 'FOnlineJsonSerializable'
Just below this struct I have a class that extends FOnlineJsonSerializable, and that compiles just fine, so it definitely has a reference to FOnlineJsonSerializable, I’m guessing this is a bug with the preprocessors.
Has anyone seen this or found a workaround? This is currently blocking me, and I’d rather not have to write a custom serializer method.
Thanks for any help!