I just created a structure for a data Table in the editor, now i wanted to use it in my cpp class to process the data table based on it.
Should i declare the struct in c++? In that case can i still create an editable data table with it?
Yes, if you want to have access and manipulate the struct from code then you need to make your UStruct in c++ and make it a BlueprintType.
example:
USTRUCT(BlueprintType)
struct FMyStruct
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FText Name;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 BaseValue;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 Amount;
};
Then you should be able to make a datatable with it.
1 Like
It must derive from FTableRowBase or it won’t work with Data Tables.
1 Like
When i import a csv file should i still be able to select that struct as data row type?
Your structure should look like this
USTRUCT(BlueprintType)
struct FMyStruct : public FTableRowBase
{
GENERATED_BODY()
// example property
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString MyProperty;
};
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.