I have been trying to edit how properties get displayed in, for example, a DataTable, for various reasons, and for that I have included several modules such as Slate, SlateCore and the PropertyEditor.
In the editor it works, but when I package, I get a linking error. After research I found out I have to add some modules only when I actually build with the editor, so I have added the following code to the .build.cs:
if (Target.bBuildEditor)
{
PrivateDependencyModuleNames.AddRange(new string[] { "UMG", "Slate", "SlateCore" });
PublicDependencyModuleNames.AddRange(new string[] { "PropertyEditor" });
}
The compilation works flawlessly, the packaging however does not. Two errors I get are the following:
“C:\Program Files\Epic Games\UE_4.19\Engine\Source\Editor/PropertyEditor/Public/PropertyEditorModule.h(9): fatal error C1083: Cannot open include file: ‘Toolkits/IToolkitHost.h’: No such file or directory”
as well as
“c:\users\userA\documents\unreal projects\projectX\source\projectX\core\ConditionCustomization.h(5): fatal error C1083: Cannot open include file: ‘IPropertyTypeCustomization.h’: No such file or directory”
The former I don’t really know anything about as that’s not my code. The latter, ConditionCustomization.h is written by me and includes the “IPropertyTypeCustomization.h”
My guess is that since packaging builds without the editor, and ConditionCustomization.h gets compiled, yet it can’t access the IPropertyTypeCustomization header since the module is not included, it fails.
I need to “not-include” editor specific modules such as PropertyEditor when packaging, but I also need to make sure that the code I have written that references those modules gets excluded. How do I do that?