x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Native Blueprint Code generations create wrong includes.

Hello guys, hope this will be helpful :)

Bug description

n 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:

    UATHelper: Packaging (Windows (64-bit)): UnrealBuildTool: U:\Unreal Projects\NativeTesting\Intermediate\WindowsNoEditor\NativizedAssets\Source\NativizedAssets\Public\SecondBP_pf1010915279.h(8): error C2504: 'AMyBase_Cpf1010915279': base class undefined UATHelper: Packaging (Windows (64-bit)): UnrealBuildTool: U:\Unreal Projects\NativeTesting\Intermediate\WindowsNoEditor\NativizedAssets\Source\NativizedAssets\Public\SecondBP_pf1010915279.h(10): error C3646: 'Super': unknown override specifier

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.

Product Version: UE 4.15
Tags:
more ▼

asked Apr 27 '17 at 07:59 PM in Bug Reports

avatar image

zamy
391 17 12 32

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hey zamy-

Thank you for submitting a bug report. I have reproduced this issue and logged a report for it here 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

Doug Wilson

more ▼

answered Apr 28 '17 at 01:44 PM

avatar image zamy Apr 28 '17 at 02:44 PM

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

avatar image Doug E ♦♦ STAFF Apr 28 '17 at 02:47 PM

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

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question