Cannot extend ATriggerBox

Version: 4.7 Preview 8

Platform: Windows 8.1

When you try to create a class that extends from TriggerBox, it gets added to VS but it fails the compilation part and spills out these errors:

Info Creating library C:\Users\Nuno
Afonso\Documents\Unreal
Projects\TC\Intermediate\Build\Win64\TCEditor\Development\UE4Editor-TC-4755.lib
and object C:\Users\Nuno
Afonso\Documents\Unreal
Projects\TC\Intermediate\Build\Win64\TCEditor\Development\UE4Editor-TC-4755.exp
Error MyTriggerBox.cpp.obj : error
LNK2001: unresolved external symbol
“public: virtual void __cdecl
ATriggerBox::EditorApplyScale(struct
FVector const &,struct FVector const
*,bool,bool,bool)” (?EditorApplyScale@ATriggerBox@@UEAAXAEBUFVector@@PEBU2@_N22@Z)
Error TC.generated.cpp.obj : error
LNK2001: unresolved external symbol
“public: virtual void __cdecl
ATriggerBox::EditorApplyScale(struct
FVector const &,struct FVector const
*,bool,bool,bool)” (?EditorApplyScale@ATriggerBox@@UEAAXAEBUFVector@@PEBU2@_N22@Z)
Error C:\Users\Nuno
Afonso\Documents\Unreal
Projects\TC\Binaries\Win64\UE4Editor-TC-4755.dll
: fatal error LNK1120: 1 unresolved
externals

The class isn’t present in content browser, and when I try to create new classes (e.g. extending AActor) it fails. I have to delete the intermediate folders, delete the classes, and regenerate the VS project.

This is because this class is referencing Editor stuf and you probably do not have the modules loaded for you project.

Add this in your YourGame.Build.cs file, right after the PublicDependencyModuleNames.AddRange:

if (UEBuildConfiguration.bBuildEditor == true)
 {
     PublicDependencyModuleNames.Add("UnrealEd");
 }

Thx, I’ll take a look at that. But maybe that should be on by default? Specially because it leaves the project in a bad state after trying it.

This didn’t work, the bug still happens.