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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

UE 4.7 project upgrade breaks UBlackboardComp

I have an AIController subclass named AEnemyAIController with the following members in the header:

 UPROPERTY(Transient)
 class UBlackboardComponent *BlackboardComp;
     
 UPROPERTY(Transient)
 class UBehaviorTreeComponent *BehaviorComp;

Both classes feature the following forward class references in the header:

 class UBlackboardComponent;
 class UBehaviorTreeComponent;

And the .cpp file features the following include macros, in addition to the ones for the header and other referenced custom classes:

 #include "BehaviorTree/BlackboardData.h"
 #include "BehaviorTree/BlackboardComponent.h"
 #include "BehaviorTree/BehaviorTreeComponent.h"
 #include "BehaviorTree/BehaviorTree.h"

In its implementation of Possess(), it features the following code:

 AEnemyBotCharacter *Bot = Cast<AEnemyBotCharacter>(InPawn);
     
     if (Bot && Bot->BotBehavior)
     {
         UBlackboardData *BlackboardData = Bot->BotBehavior->BlackboardAsset;
         BlackboardComp->InitializeBlackboard(BlackboardData);
     }

All of the above worked as expected in UE 4.6.1, but upgrading the project to UE 4.7 with no changes to the code results in the following error:

 error: non-const lvalue reference to type 'UBlackboardData' cannot bind to a value of unrelated type 'UBlackboardData *'

Either the program somehow does not know what UBlackboardData is (which would likely be due to using the wrong include macro when attempting to reference the relevant code, with the include macro being #include "BehaviorTree/BlackboardData.h"), I'm handling pointers wrong, the engine code has changed some of its pointer handling, or it's something else entirely. What could be the cause of the same code being broken in UE 4.7 despite working perfectly and as expected in UE 4.6.1?

Product Version: Not Selected
Tags:
more ▼

asked Feb 26 '15 at 04:58 AM in C++ Programming

avatar image

Alonzo Machiraju
62 12 15 20

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

UBlackboardComponent::InitializeBlackboard switched over to using referenced rather than pointers, and I missed this one while supplying transition API. Sorry!

Try this:

BlackboardComp->InitializeBlackboard(*BlackboardData);

Of course you need to make sure BlackboardData != nullptr before doing that.

BTW, why do you need to do blackboard setup manually? RunBehaviorTree will set up your BB for you.

Cheers,

--mieszko

more ▼

answered Feb 26 '15 at 11:31 AM

avatar image

MieszkoZ STAFF
7.3k 223 57 412

avatar image Alonzo Machiraju Feb 27 '15 at 02:12 AM

To answer your question, it's because I used code from a tutorial that sets up the blackboard manually.

avatar image MieszkoZ STAFF Feb 27 '15 at 11:13 AM

Which tutorial is that? Is that Epic's?

avatar image Alonzo Machiraju Feb 27 '15 at 08:33 PM

IIRC it's Epic's.

avatar image Belug Dec 13 '15 at 01:56 AM

I think you were talking about that tutorial from Chad Reddick :

https://www.youtube.com/watch?v=VxvahnKYB8E

So it was not an Epic tutorial.

there's a lot of thing to change to make it work with 4.10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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