In Unreal Engine’s terminology, a Data Asset is an asset that stores, guess what, data. It can be used, for example, to decouple the configuration from behaviour.
Data Assets in Unreal Engine all inherit from the UDataAsset
.
You can define a new Data Asset type by inheriting from UDataAsset
and then your new data asset will become available
in the Pick Data Asset Class Dialog:
I’m used to create new data assets using C++, you inherit from UDataAsset
, add some members with UPROPERTY
and done, however, recently I wanted to create one using only Blueprints.
Looking into existing tutorials on data assets, people usually say that you must create your data asset type in C++ first.
That is actually true, but only if you want to inherit directly from UDataAsset
. But there is a way to create a new data assets using only blueprints.
The procedure is as follows:
- Create a new Blueprint class that inherits from
UPrimaryDataAsset
- Add variables in your Blueprint
- Your blueprint class will now be available in the Pick Data Asset Class Dialog.
Here is a simple example of a blueprint that inherits from UPrimaryDataAsset
with three variables:
And the blueprint type showing up as a new data asset type:
When you create a new asset of this type and double click in it, you can see that all the variables from the blueprint class are now fields of the new data asset:
So this is how you create a new data asset type using only blueprints, no C++ involved.