Cannot package project due to use of a Factory

I use a custom factory in my project to allow easy creation of custom assets in the editor. When I try to package my project, I get an error saying “Cannot open include file: ‘Factory.generated.h’: No such file or directory”.

My build output is here in case anybody wants to see it:

I understand Factories are really only useful when developing in the editor, is there some way to conditionally exclude them from the build process when packaging?


Are factories something that should be stopping the packaging process in the first place?

This is a much simpler question, could I at least get an answer to this?

Post is now six weeks old, bump

I had a similar problem with a *.generated.h not being found/built. Ended up deleting the “./Intermediate/Build” folder of the project to fix it. The next build time was a bit of a bear, but it fixed the problem for me. Wasn’t related to a factory class though.

If that doesn’t work, I think I also greped for files under “./Intermediate” containing references to the offending header and deleted some those as well.

Extremely simple question, post is now over 3 months old

This did not fix the issue. Thanks though.

UFactory is declared at:

Module: UnrealEd

Header: Editor/UnrealEd/Classes/Factories/Factory.h

You cannot package a game shipping Editor modules. If you want to use factories, you must create a Module with IMPLEMENT_MODULE() macro and create your factories in there; making sure that module will NOT be loaded by GAME modules. This is why your packaging fails, because you implement references to classes that are Editor only.

To create an Editor Module for your game project, look at a guide here: