Asset Definition - Linker Errors

As we’re familiar, AssetTypeActions were replaced by AssetDefinitions in UE5.2.

When trying to implement my own AssetDefinition, by creating

#include "AssetDefinitionDefault.h"

UCLASS()
class UAssetDefinition_MyDefinition : public UAssetDefinitionDefault
{
	GENERATED_BODY()

public:
	virtual FText GetAssetDisplayName() const override;
	virtual FLinearColor GetAssetColor() const override;
	virtual TSoftClassPtr<UObject> GetAssetClass() const override;
	virtual TConstArrayView<FAssetCategoryPath> GetAssetCategories() const override;
	virtual EAssetCommandResult OpenAssets(const FAssetOpenArgs& OpenArgs) const override;
};
// Ommitted function bodies for brevity

I get 20-30 linker errors complaining that there is an unresolved external symbol for each of the virtual functions in UAssetDefinition.

Which I find weird because when I check the AssetDefinition.h, there are bodies for the functions declared. I must be doing something wrong as no one else seems to have this issue, thanks :slight_smile:

Shouldn’t you have #include "AssetDefinition_MyDefinition.generated.h" near the top of your header?

Also, what are your linker errors? It would help if we could see them.

Sorry, to keep it short I omitted most of the headers, I do have the generated header included.

I’m not at home so I can’t send you screenshots or direct copies of the linker errors, but they’re basically complaining about:

virtual bool CanImport() const { return false; }
virtual bool CanMerge() const { return false; }
virtual void BuildFilters(TArray<FAssetFilterData>& OutFilters) const;
virtual bool CanRegisterStatically() const;

Along with pretty much every other function defined in UAssetData in the AssetDefinition.h.

(Note that in my example functions, the ones I left the body off are implemented in AssetDefinition.cpp)

The real confusion I’m facing is that I can see these are implemented, and I know that “AssetDefinitionDefault.h” includes “AssetDefinition.h”, so I don’t understand how my code can’t find the function impls.

Got the solution, had to add AssetDefinition module to my Build.cs PublicDependencyModuleNames

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.