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"

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

alt text

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"
 
 UCLASS(BlueprintType)
 class TEST_API UTestObject : public UObject
 {
     GENERATED_BODY()
 
 public:    
         
     UTestObject();
 
     UPROPERTY(EditAnywhere, BlueprintReadOnly)
     int32 testIntInDeepObject;
 };

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

alt text

The error messages: alt text

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!

Product Version: UE 4.8
Tags:
screen1.png (124.2 kB)
screen2.png (120.5 kB)
screen3.png (24.8 kB)
more ▼

asked Aug 04 '15 at 08:10 PM in Blueprint Scripting

avatar image

irdc
113 14 16 20

avatar image Pierdek Aug 04 '15 at 08:30 PM

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

 Engine\Source\Programs\UnrealHeaderTool\Resources\UHTDebugging\TestObject.h
 
 UCLASS()
 class UTestObject : public UObject

Try rename UTestObject class to something else UMyTestObject for example.

avatar image irdc Aug 04 '15 at 09:08 PM

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:

alt text

screen4.png (179.2 kB)
(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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