Data inheritence with UDataAsset

We have a C++ based asset-type (“UBiomeInfo”) that is a subclass of UDataAsset that we use throughout our game.

However, we would like to make use of some data inheritance, so that a single “master” asset could provide reasonable values for all parameters and then child assets could override only targeted parameter values.

However, it doesn’t seem to be possible to create a child of a UDataAsset.

I CAN create a blueprint based on the UDataAsset type (again, “UBiomeInfo”). I can then set up parameters, and I can also create child assets that change parameter values in the parent. HOWEVER, other structure and blueprints that wish to point to a UBiomeInfo do not appear to recognize the new assets as UBiomeInfos (in this case, another configuration file which contains a pointer to the BiomInfo asset will not populate its field in the editor with the new BP-based assets in question).

Is there a solution to this? Ideally UDataAssets should be able to inherit from one another. Failing this, is there some other way to link to the BP-based data assets.

Thanks!

2 Likes

A bit too late to answer disla, but for future reference UPrimaryDataAsset seems to be the correct class to inherit from to enable blueprint-recognizable inheritance chains. Here’s the description of it, copied directly from Engine/DataAsset.h

A DataAsset that implements GetPrimaryAssetId and has asset bundle support, which makes it something that can be manually loaded/unloaded from the AssetManager

Making blueprint subclasses of this is useful because you can make blueprint-only primary asset types

Blueprint subclasses will end up with a PrimaryAssetType equal to the name of the first native class found going up the hierarchy, or the top level blueprint class that directly subclasses this

IE, if you have PrimaryDataAsset → ParentNativeClass → ChildNativeClass → BlueprintAsset the type will be ChildNativeClass

Whereas if you have PrimaryDataAsset → ParentBlueprintClass → ChildBlueprintClass the type will be ParentBlueprintClass

To override this behavior, override GetPrimaryAssetId in your native class

Hope this helps.

3 Likes