UnrealEd class "TexAligner.h" can't include its own generated .h file when packaging

I’ve been trying to get an editor module to run so that property specialization gets excluded from the packaged builds, as that leads to errors.

The project compiles and the module gets hooked up, but when I package, it gives me the following error:
UATHelper: Packaging (Windows (64-bit)): C:\Program Files\Epic Games\UE_4.19\Engine\Source\Editor\UnrealEd\Classes\TexAligner/TexAligner.h(14): fatal error C1083: Cannot open include file: ‘TexAligner.generated.h’: No such file or directory

I have not touched the TexAligner class at all, nor the generated header. I still deleted all binaries, intermediates etc. pp. just to make sure.
I heavily suspect it has something to do with the .build files, but I don’t really understand how this could happen. What could cause the TexAligner.h to not find its own generated .h file? I checked to make sure and it does exist.

Hi,
I’m having a the same issue. The build runs fine with Editor builds, for instance Development Editor, but fails for Development.

Hi

I have fixed this issue although I do not fully understand the reason behind it. The Game .Build file should have the following code in its main body:

if(Target.Type == TargetType.Editor) {
   PublicDependencyModuleNames.Add("EditorModule");
}

This ensures that your editor module gets compiled into a .dll only in editor builds, but otherwise not. Also, in my own module header file, I did NOT include UnrealEd.h. The .Build file of my module only includes Core, MyGame and the editor module I want to use, such as “PropertyEditor”.

Hi, thanks for the reply. It given me an idea.

First of all I think you might not be using UE 4.19 ?
The following logic no longer works in 4.19:

 if(Target.Type == TargetType.Editor)

I think the build tool now automagically detects an editor module and adds it in editor builds.
I just had to remove the line:

ExtraModuleNames.Add("EditorModule");

In my in the …Game.Target.cs . The ifcheck doesn’t seem to be needed anymore.

I am using 4.19 and it does work for me.

However, I do think I recall having tried this yesterday too, but getting compile errors. It did work today though. Keep in mind I used this in the Game.Build file, not the .Target files.

So you are saying you basically do not have your EditorModule anywhere aside from the .uproject file? Neither in .Build nor in the Target files?

Basically yes, but left the Editor module in Editor.Target.cs as described here:

https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1424393-what-happend-to-targetinfo-target-in-4-19?p=1434486#post1434486