#unreal

C++-only interfaces

Use meta=(CannotImplementInBlueprint) to declare an interface C++-only.

Using interfaces in other modules

The template for creating C++ interfaces doesn’t include the MYGAME_API macro in the UInterface declaration. This can cause errors during compilation if you try to use the interface in a different module such as an Editor Module.

To fix the error, add the missing MYGAME_API so the code looks something like this:

class MYGAME_API UYourInterface : public UInterface

Example error

0>KotItemDefinitionActorFactory.cpp.obj: Error  : LNK2019: unresolved external symbol "private: static class UClass * __cdecl UKotItemInterface::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UKotItemInterface@@CAPEAVUClass@@XZ) referenced in function "public: virtual class UObject * __cdecl UKotItemDefinitionActorFactory::GetAssetFromActorInstance(class AActor *)" (?GetAssetFromActorInstance@UKotItemDefinitionActorFactory@@UEAAPEAVUObject@@PEAVAActor@@@Z)