Restricting UDataTable UPROPERTY selector in editor to data tables with specific row structs

I’m using several data tables with a various row structs. I have a UActorComponent sub-class that has UPROPERTY UDataTable* member variables for each of the different tables.

One annoyance is that when picking the data table assets for each UPROPERTY, all of the data tables show up in the picker, even then my code requires tables with a specific row structure.

Is there a way to restrict which data tables show up in the picker, so that only data tables with compatible row structs are listed?

1 Like

Yes, using RequiredAssetDataTags with RowStructure. For an example, see URichTextBlock’s implementation in RichTextBlock.h.

UPROPERTY(EditAnywhere, Category=Appearance, meta=(RequiredAssetDataTags = "RowStructure=RichTextStyleRow"))
class UDataTable* TextStyleSet;
13 Likes

wow, good on you to come back and give yourself the answer 2 years later :slight_smile:

1 Like

It’s because I forgot and found my same question 2 years later :wink:

3 Likes

As I can’t find any documentation about this, do you have any idea how you would be able to restrict FDataTableRowHandle to tables with certain structs in the same way? (if possible?)

For me, to restrict FDataTableRowHandle to a certain struct, meta=(RowType="MyStruct"), worked fine

1 Like

UE5.1 and 5.2

Create a new Data Table, place the cursor over your struct to check which is the correct “RequiredAssetDataTags”.

Should be /Script/ProjectName.MyStruct (FMyStruct → MyStruct, without the F)

image

meta = (RequiredAssetDataTags = "RowStructure=/Script/VRPhysicsBrawl.PhysicalMaterialPhysicsDamageData")


In general:

For projects:

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MyCategory", meta = (RequiredAssetDataTags = "RowStructure=/Script/MyProject.MyStruct"))
		UDataTable* MyDataTable = nullptr;

For plugins:

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "MyCategory", meta = (RequiredAssetDataTags = "RowStructure=/Script/MyPlugin.MyStruct"))
		UDataTable* MyDataTable = nullptr;

Thanks to Rominitch

18 Likes

I literally wasted hours before finding this post and understanding that the update to 5.2 was the reason of datatables no longer showing up in the dropdown panel…
I flagged your post to be marked as solution, thank you so much!

1 Like

Now, for the fun question – anyone know how to do something similar in a DataTable reference in Blueprint? :smiley:

@eblade Haven’t tried it yet, but you should be able to swing it with this plugin:

@Klian Thanks so much, I too spent longer than I should have trying to make this work just now. You’re the best!

1 Like

but you should be able to swing it with this plugin:

… well, i’m definitely going to give it a look. Using datatables for all sorts of stuff, and it’d be nice to have this work. I’m kind of curious if I can use it and submit the altered metadata without having to have everyone else install the plugin… because I don’t think I’m going to be able to convince corporate that we should all be using a plugin from someone called “DoubleDeez” :smiley:

Also, great to see you here! Xitter has turned into a cesspool.

1 Like

Good to see you also :smiley: I checked and the metadata persists even after the plugin is uninstalled so you should be good.

Amazing, I want to get this comment framed.

1 Like

Thanks mate! I’m sorry I didn’t notice your kind words earlier :sweat_smile:

1 Like