# Native Blueprint Code generations create wrong includes

**URL:** <https://forums.unrealengine.com/t/native-blueprint-code-generations-create-wrong-includes/392090>\
**Category:** Blueprint\
**Tags:** workaround, unreal-engine, bug-report, packaging-projects, Blueprint, question\
**Created:** [April 27, 2017, 7:59pm UTC](https://forums.unrealengine.com/t/native-blueprint-code-generations-create-wrong-includes/392090 "2017-04-27T19:59:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zamy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zamy](https://forums.unrealengine.com/u/zamy)\
**Post date:** [April 27, 2017, 7:59pm UTC](https://forums.unrealengine.com/t/native-blueprint-code-generations-create-wrong-includes/392090/1 "2017-04-27T19:59:12Z")

</div>

Hello guys, hope this will be helpful 🙂

## Bug description

In my project i tried for the first time the blueprint nativization procedure, and it failed strangely. Digging it, i found out that it was generating the wrong includes for the blueprints.

In fact, it was skipping a parent include for some classes, for example if i had:

1. C++ class named A
2. BlueprintClass named B, derived from A
3. BlueprintClass named C, derived from B

int the C class header it was correctly extending B, but it was including A directly, resulting in a compiling failure (unknown class B).

I had an hard time reproducing it on a fresh project, below you can find the steps.

It’s kinda hard to reproduce it, but this way it fails most of the times.

## How to reproduce

**Note:** Since testing it requires packaging, i suggest to disable “Full rebuild”: i tested with it too, the result is the same.

**Note 2:** This steps list will show a setup for a working project, then will show how to mess it up, and how to workaround it.

Tested on 4.15.1-0

* * *

**Initial setup to a working project:**

- Create a new “C++ Basic Code” project, name it “NativeTesting”: Desktop, maximum quality and no starter content
- Build the newly created project in VS
- Open the editor
- Create a new C++ class, based on StaticMeshActor, and call it “MyStaticMeshActor”.
- The following code will be generated, we’ll leave it as it is:

MyStaticMeshActor.h

```
  // Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Engine/StaticMeshActor.h"
#include "MyStaticMeshActor.generated.h"

/**
 * 
 */
UCLASS()
class NATIVETEST_API AMyStaticMeshActor : public AStaticMeshActor
{
	GENERATED_BODY()
	
};

```

MyStaticMeshActor.cpp

```
// Fill out your copyright notice in the Description page of Project Settings.

#include "NativeTest.h"
#include "MyStaticMeshActor.h"

```

- Close the editor and recompile
- Now return to editor, and create a new blueprint class, with “MyStaticMeshActor” as parent, and call it “MyBase”. Open it, save, close.
- Create a new blueprint class, with “MyBase” as parent, and call it “SecondBP”. Open it.
- Add a cube component, save and close.
- Put it in the level, and save it with name “MyLevel”
- Open Project Settings, and go to Packaging section
- Set BuildConfiguration to Development, uncheck “Full Rebuild”, and under blueprints set Nativization Method to “Inclusive”
- Package the project for windows 64: it will work successfully.

* * *

**Create the problem:**

- Open Project Settings, and go to Packaging section

- Under blueprints set Nativization Method to “Exclusive”

- Open “SecondBP”, go to class settings and enable “Nativize”

- Try to package again.

- it should fail with errors like these:

In fact, looking at the generated code, in Intermediate/WindowsNoEditor/NativizedAssets/Source/Public/SecondBP\_\_\*\*\*\*.h, we have:

```
#include "Blueprint/BlueprintSupport.h"
#include "NativeTesting/MyStaticMeshActor.h"
class UStaticMeshComponent;
#include "SecondBP__pf1010915279.generated.h"
UCLASS(config=Engine, Blueprintable, BlueprintType, meta=(ReplaceConverted="/Game/SecondBP.SecondBP_C", OverrideNativeName="SecondBP_C"))
class ASecondBP_C __pf1010915279 : public AMyBase_C__ pf1010915279
{

```

[…]

Notice how it’s including MyStaticMeshActor.h instead of MyBase\_C\_\_pf1010915279.h

* * *

**Workaround:**

- Open the blueprint “MyBase”
- Connect something to “BeginPlay”, like a “Print String” node, save and close (this will make it a “normal blueprint”, not a data-only).
- Try to package again, it will work.

## Current Behaviour

On exclusive nativization, seems like it fails to generate the correct includes if the parent is a data-only blueprint.  
In fact, in the SecondBP\_\*\*\*\*.h it places:

```
#include "NativeTesting/MyStaticMeshActor.h"

```

instead of:

```
#include "MyBase__pf1010915279.h"

```

As already stated, it seems directly related to data-only blueprint, but it doesn’t happen on an inclusive nativization.

## Expected behaviour

It should always generate the correct include (with the right parent class).

## Conclusions

I had an hard time tackling this, it seemed pretty randomic, and i lost a lot of time due to the numerous packaging launches.

I noticed that sometimes it still work, but trying around i can always make it fail in the same way (this is the simplest i found).

I hope this can help you, and maybe others that had issues like me, with the workaround.

Let me know if you need more infos 🙂

Simone Daminato

[edit1] : fixed some typos.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [April 28, 2017, 1:44pm UTC](https://forums.unrealengine.com/t/native-blueprint-code-generations-create-wrong-includes/392090/2 "2017-04-28T13:44:12Z")

</div>

Hey

Thank you for submitting a bug report. I have reproduced this issue and logged a report for it here [Unreal Engine Issues and Bug Tracker (UE-44488)](https://issues.unrealengine.com/issue/UE-44488) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers

---

<div class="post-metadata">

**Author:** ![zamy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zamy](https://forums.unrealengine.com/u/zamy)\
**Post date:** [April 28, 2017, 2:44pm UTC](https://forums.unrealengine.com/t/native-blueprint-code-generations-create-wrong-includes/392090/3 "2017-04-28T14:44:54Z")

</div>

Thanks a lot .  
I found another small issue of nativization with Arrays of TSubclassOf.  
Do you prefer if i report it in here or open another thread?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [April 28, 2017, 2:47pm UTC](https://forums.unrealengine.com/t/native-blueprint-code-generations-create-wrong-includes/392090/4 "2017-04-28T14:47:15Z")

</div>

It would be best to create a new post to track each issue separately.
