I’ve added the following to the top of my HelloWorldPrinter.h file (which was created from this programming starter documentation project). The goal is to auto create a new cube from code within the editor as a proof of concept.
#include "UnrealEd.h"
I then have the following in my .cpp, which intellisense seems to agree with just fine. Which was borrowed from Unreal’s own test code in the repo.
UWorld* World = GEditor->LevelViewportClients[0]->GetWorld();
UCubeBuilder* cubeBuilder = Cast<UCubeBuilder>(GEditor->FindBrushBuilder(UCubeBuilder::StaticClass()));
cubeBuilder->X = 4096.0f;
cubeBuilder->Y = 4096.0f;
cubeBuilder->Z = 128.0f;
cubeBuilder->Build(World);
GEditor->Exec(World, TEXT("BRUSH MOVETO X=0 Y=0 Z=0"));
GEditor->Exec(World, TEXT("BRUSH ADD"));
However, when I go to build I get the following error (yadayada = the long path to my project).
yadayada.....lib and object yadayada.exp
HelloWorldPrinter.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) private: static class UClass * __cdecl UCubeBuilder::GetPrivateStaticClass(wchar_t const *)" (__imp_?GetPrivateStaticClass@UCubeBuilder@@CAPEAVUClass@@PEB_W@Z) referenced in function "class UCubeBuilder * __cdecl Cast<class UCubeBuilder>(class UObject *)" (??$Cast@VUCubeBuilder@@@@YAPEAVUCubeBuilder@@PEAVUObject@@@Z)
HelloWorldPrinter.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class UBrushBuilder * __cdecl UEditorEngine::FindBrushBuilder(class UClass *)" (__imp_?FindBrushBuilder@UEditorEngine@@QEAAPEAVUBrushBuilder@@PEAVUClass@@@Z) referenced in function "public: virtual void __cdecl AHelloWorldPrinter::BeginPlay(void)" (?BeginPlay@AHelloWorldPrinter@@UEAAXXZ)
HelloWorldPrinter.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class UEditorEngine * GEditor" (__imp_?GEditor@@3PEAVUEditorEngine@@EA)
yadayada.dll : fatal error LNK1120: 3 unresolved externals
Is there a better way to include the editor classes and have them resolved? Or am I doing something wrong.