Getting a bit confused with UDataAsset hierarchies, need some help.
Let’s say I have
class UBaseAsset : public UDataAsset
{
GENERATED_BODY()
public:
UPROPERTY(EDitAnywhere, BlueprintReadOnly)
FString TypeName;
};
class UDerivedAsset1 : public UBaseAsset
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadOnly)
int DerivedValue1;
};
class UDerivedAsset2 : public UBaseAsset
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadOnly)
int DerivedValue2;
};
Every time I create an instance of the derived asset (1 or 2) I need to fill in “TypeName” even though every instance of 1 should share the same TypeName. For simple fields like strings it’s kinda ok, I just add the constructor in the derived classes and fill in the fields. But that’s error-prone and fiddly for assets like textures that need to be provided.
So I created a Blueprint data asset BP_DerivedAsset1 as a child of UDerivedAsset1 where I fill in the base field(s) in the drop-downs. However, I can’t use BP_DerivedAsset1 when I need to provide a UBaseAsset - I have to create a whole new data asset (instance) in the content drawer. (Unreal is confusing here because the icons for the asset BP and the asset instance are the same.) This seems wasteful, so I can’t help but think I’ve missed something?