Using legacy-style #include paths in a game project is allowed by UBT by default, but it's currently not compatible with Blueprint nativization, as it does not account for this possibility.

Current workaround: Add the following line to the constructor in Engine\Content\Editor\Templates\PluginModule.Build.cs.template:

bLegacyPublicIncludePaths = Target.bLegacyPublicIncludePaths;

Then repeat step #8.

Steps to Reproduce
  1. Open a new, blank C++ project.
  2. Add a new C++ class derived from Actor (MyActor).
  3. In the new C++ class header file (MyActor.h), add:
    #include "DateTime.h"
  4. Compile in Visual Studio and wait for hot reload to finish.
  5. Right-click the MyActor class in the Content Browser and choose "Create Blueprint class based on MyActor."
  6. In the Blueprint Editor, add a new variable of any type. Compile, save and close the Blueprint editor.
  7. In Edit->Project Settings->Packaging, change "Blueprint Nativization Method" to "Inclusive."
  8. Choose File->Package Project->Windows->Win64, choose a location and proceed.
  9. Note that a C++ compiler error will result in the Build phase after cooking has completed:
    [1/3] Module.NativizedAssets.gen.cpp
    UATHelper: Packaging (Windows (64-bit)):     D:\dev\local\Projects\CppTest\Source\CppTest/MyActor.h(6): fatal error C1083: Cannot open include file: 'DateTime.h': No such file or directory


Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-66378 in the post.

Login to Vote

ComponentUE - Gameplay - Blueprint
Affects Versions4.
Target Fix4.22
Fix Commit4560630
Main Commit4736445
Release Commit4862694
CreatedNov 10, 2018
ResolvedNov 12, 2018
UpdatedFeb 12, 2019
View Jira Issue