I have a couple of custom data assets in my project. I have a custom primary asset type for this data asset class, used in handling it using the asset manager. It was working fine yesterday, but for some reason it stopped working. The asset manager can never find my custom data assets. What is even stranger is that for some reason the asset manager can’t find any custom asset with class derived from UDataAsset or UPrimaryDataAsset I’ve tried. It however does find data assets defined in engine.
My data assets derive from UPrimaryDataAsset.
The asset manager has no trouble in finding all other classes of assets, it just can’t find those derived from Data Asset for some reason.
UCLASS(BlueprintType)
class SGAME_API UItemIdentifier : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties")
FString DisplayName;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties")
TSubclassOf<class UItem> ItemClass;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties")
bool Stackable = true;
//Mass in kg per unit
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties")
float Mass = 1.0f;
//Volume in liters
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties")
float Volume = 1.0f;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties")
class UTexture2D* Icon;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties")
class UStaticMesh* DroppedMesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item Properties")
TSubclassOf<ADroppedItem> DroppedItemClass = ADroppedItem::StaticClass();
};
How are you getting the output shown in your first screenshot? I’ve created a class based on the code you provided, but I’m not sure how you’re reporting on the different data assets you have. Please provide full reproduction steps to help me investigate the issue locally.
I simply created this data asset, set the asset manager to the settings on the last screenshot and used console command AssetManager.DumpTypeSummary. I’m not using any custom code to handle those assets, just the stock implementation of Asset Manager.
Please try checking the “Is Editor Only” checkbox. If that doesn’t help, try making your class inherit from UDataAsset rather than UPrimrayDataAsset. When I created a copy of your class with these changes, the AssetManager.DumpTypeSummary command properly returned my custom data assets.
I changed it to just Data Asset and it seems to be working. However it still does not find data assets that inherit from a class derived from UDataAsset, for example I have UItemIdentifier that inherits from UDataAsset and UToolItemIdentifier which inherts from UItemIdentifier. The Asset manager does find the base class but it can’t find the derived class. I need both the base and derived class to be loadable by Asset Manager. Is there any way to achieve this?
I was able to confirm that grandchildren of UDataAsset all experience the behavior you describe. I have entered a report for this behavior that you can follow here: Unreal Engine Issues and Bug Tracker (UE-50016)
Hello, I see that the issue is marked as resolved on the issue report, however after updating to 4.17.2 the bug still persists. I’d suggest looking into that.
On 4.17.1 and ran into this issue as well. Current workaround was to derive from UDataAsset and basically duplicate GetPrimaryAssetId() from UPrimaryDataAsset. Making the class blueprintable and creating subclasses that way.