So i have these two structs:
USTRUCT(BlueprintType)
struct FLevelMapStruct : public FTableRowBase
{
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 LocationX;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 LocationY;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSubclassOf<ATile> TileType;
};
USTRUCT(BlueprintType)
struct FLevelStruct : public FTableRowBase
{
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UDataTable* MapTable;
};
I want to allow blueprint data table created with row structure FLevelStruct to only be able to use data table created with FLevelMapStruct row structure in field MapTable.
Can someone point me in the right direction about how could i do this?
Edit: the MapTable will need to be able to point to blueprint data table
For custom Class with Unreal 5.1, I use this :
UPROPERTY(meta = (RequiredAssetDataTags = "RowStructure=/Script/MyProject.MyData"))
UDataTable* database = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (RowType = "/Script/MyProject.MyData"))
FDataTableRowHandle rowIntoDatabase;
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (RowType = "/Script/MyProject.MyData"))
TArray<FDataTableRowHandle> someRowIntoDatabase;
It's same comment: Note that the F isn't included in the name of the RowStructure, so MyData rather than FMyData
It's work inside USTRUCT, I create my DataTable with it.
I have just hit this exact issue myself and I believe I have the answer (works for me at least with UE 4.26). Have seen a few posts asking with no answer so figured I should share my solution.
In the UPROPERTY macro add meta=(RequiredAssetDataTags = "RowStructure=*YoureRowTypeHere*")
So in your example you would have
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(RequiredAssetDataTags = "RowStructure=LevelMapStruct"))
UDataTable* MapTable;
Note that the F isn't included in the name of the RowStructure, so LevelMapStruct rather than FLevelMapStruct
In editor now, your property should only list the tables that use that type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With