Inherite from UDataTable

Hi there!

I’m new on Unreal so maybe what I’m trying to do isn’t allowed.

I’m using DataTable but actually I want a DataTable with more feature so I started to write in c++ a class extending UDataTable (class UMyDataTable : public UDataTable).

and adding a
UProperty(…)
FName TestName

Actually the variable is exposed in the blueprint settings panel but… I can’t see anymore the view “pick structure” (flow is defined inside UDataTableFactory).

How I can still assign a valid FTableRowBase to MyDataTable?

Hi ! It feels like I’m looking for doing more or less the same but I’m stuck earlier in the process.

Once created the class and compiled, how did you create an asset that used this class ?

For blueprint classes, it’s quite easy as one just uses the “Create Basic Asset → blueprint class”. But for other asset types, it seems like its necessary to go through a whole “Asset factory” thing like they did there : Is it possible to add custom asset category for custom Data Asset? - C++ Programming - Unreal Engine Forums

Did you have to do it too ?

If you want to create a Data Table (Note not an asset) with specifik variables etc. all you need is a Struct that inherits from Table Row Base, here is an example.
So when i create a Data Table this struct will be we available to inherit the data table from, so i have the columns there.

#include “Runtime/Engine/Classes/Engine/DataTable.h”

USTRUCT(BlueprintType)
struct FVertexPaint_Datatable_Struct : public FTableRowBase {

GENERATED_BODY()

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Vertex Paint Data Table")
	FString defaultMaterial;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Vertex Paint Data Table")
	FString channelColor;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Vertex Paint Data Table")
	FString materialAtChannel_0;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Vertex Paint Data Table")
	FString materialAtChannel_1;

};

Thanks for your contribution, it may help some people looking around data tables. But I don’t think that’s what we were discussing here.

In my case, what I would like would be to override the virtual functions of UDatatable like PostEditChangeProperty of the data table itself. I use them for configuring some blueprint assets and I would greatly like to be able to automatically update some data in my asset as soon as a row is changed.

Hi Koulounil,

Do you find any way to do that since?

Actually, I’ve put it aside for the moment. As far as I understand it, it needs to create an editor plug-in, and I’ve not started doing that yet, as it will need me to learn a bunch of new skills.

When I’ll get back to this, I think I’ll create this editor plug-in and use the link I posted before :
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1414667-is-it-possible-to-add-custom-asset-category-for-custom-data-asset

I’ll also do several other things inspired by this video : C++ Extending the Editor | Live Training | Unreal Engine - YouTube

Thank you for your Quick response!

My goal was to categorized UDataTables (to use as a property of a blueprint with a TSubclassOf) and be notified when a row>column of the datatable is updated, Using an array of
UDataAsset do the tricks for me now, but i’ll be really interested when you achieve this editor plugin.

I’ll subscribe to the forum’s link to be notified,
Thanks again !

1 Like

For developers who came here:

Basically this page is talk about to add custom game logic to an UDataTable Object.

You can understand this demand by an UDataAsset with an TMap in it:

UCLASS(BlueprintType)
class UCustomDataTable : public UDataAsset
{
	GENERATED_BODY()

public:

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TMap<FName, FTableRow> MapData;

..............

	UFUNCTION(BlueprintCallable)
	void CustomFunction();

..............
};
  1. UDataAsset can have custom game function, but don’t have an Row-Column view in UE Editor
  2. UDatatable can have an Row-Column view, but developer would face problem when they try to inherite from UDataTable, like Valerik87 did.

I haven’t try the inherite process, but since someone tried it for me, I think it would be better to use an functionlibrary to work with UDataTable.