Download

A question about using plugins

I want to distribute public interface headers with my plugin in order to allow game
I used the engine plugin to do an experiment,I chose the UObjectPlugin。

first,modify config:



PublicDependencyModuleNames.AddRange(
            new string] {
                "Core",
                "CoreUObject",
                "Engine",
                "InputCore",
                "UObjectPlugin"
            }
        );


then I’m trying to create a plug-in object in the project code:




#include "MyHUD.h"
#include "MyPluginObject.h"

AMyHUD::AMyHUD(const FObjectInitializer& ObjectInitializer /*= FObjectInitializer::Get()*/)
    : Super(ObjectInitializer)
{
    UMyPluginObject* MyTestPluginObject = NewObject<UMyPluginObject>(this, TEXT("TestMyPluginObject"));
}



An error LINK occurred while compiling the code:




 2>TestNullProjectGameMode.cpp.obj : error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UMyPluginObject::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@UMyPluginObject@@CAPEAVUClass@@PEB_W@Z),referenced in function "class UMyPluginObject * __cdecl NewObject<class UMyPluginObject>(class UObject *)" (??$NewObject@VUMyPluginObject@@@@YAPEAVUMyPluginObject@@PEAVUObject@@@Z) 
 2>D:\Unreal Projects\TestNullProject\Binaries\Win64\UE4Editor-TestNullProject-6519.dll : fatal error LNK1120: 1 unresolved externals



How do I create plug-in objects in game code?

If you want to make a plugin, then you should watch this. Epic just made plugin development a lot easier. It may make your problem a non-problem.

https://www.youtube.com/watch?v=hr9ybCCPw9Y&t=785s

Thanks, I solved this