Adding c++ header to Actor breaks Blueprints

Greetings. As I am still learning Blueprints, I am not sure if this is a possible bug or if this is working as intended. It seems more of a bug.

Basically, I have a C++ actor that is Blueprint accessible. In my Level Blueprints, I create a reference to this object that is used in the a Blueprints HUD. The actor contains an array of structures, test integers and some other things to help test the interaction between the GUI and the c++ engine.

In my HUD, I have a button that, when pressed, prints a message to the log and updates a test field in the HUD (disregard the very bottom chain, it’s for testing):

This works fine. When the button is pressed, TestActorFunction is called. The Food variable is also set fine; I grab a variable that is located in the first index of the array of structures.

Now, I go into the TestActor C++ object file and add:

#include "GameFramework/Actor.h"
#include "Tests/TestObject.h" // <-- ADDED THIS
#include "TestActor.generated.h"

TestObject is just a basic UObject:

#include "Object.h"
#include "TestObject.generated.h"

class TEST_API UTestObject : public UObject


	UPROPERTY(EditAnywhere, BlueprintReadOnly)
	int32 testIntInDeepObject;

This compiles perfectly. Unfortunately, this causes Blueprints to freak out:

The error messages:

Here is why I think it’s a bug. After the .h file has been added and compiled, I can go back into my HUD Blueprint, delete the bad nodes, reconstruct the array, get and break nodes and everything works fine. This basically means that entire chains of nodes needs to be deleted and reconstructed when adding new header files to c++ objects. This can’t be working as intended. Or is it?

Thanks for any help!

I believe you got a collision in class names and the HeaderTool is confused.


class UTestObject : public UObject

Try rename UTestObject class to something else UMyTestObject for example.

Thank you for the fast response!

I deleted TestObject from the project and added a new UObject: AnotherTestObject.

Changed the headers:

#include "GameFramework/Actor.h"
#include "Tests/AnotherTestObject.h"
#include "TestActor.generated.h"

And the exact same thing happened: