How to initialize a C++ Blackboard
I am building an C++ based AIController, and I would like to use the Blackboard but not linked with a BehaviorTree.
So, on the constructor of the controller I create the blackboard:
and normally on the override of the Possess(APawn* pawn) method
But, since I don't want to use the behavior tree, I can not figure out how to initialize or setup the blackboard from C++.
Thanks in advance,
asked Jan 03 '17 at 12:56 AM in C++ Programming
Thank you Mieszko. My problem was more complex than just NewObject<>. I had to read some of the UE4 source code to figure out what was going on, in the end I took me a bit of time to understand how the implementation of the Blackboards work. I leave here the steps with some clarification, it may help someone else to figure things out quickly in the future (maybe me in a year time or so).
So before you initialize the UBlackboardComponent you need to define the key (names) and associated types you want to store. So an obvious function would be to have a AddKey function either on the BlackboardComponent or BlackboardData, but, such thing does not exist. Again documentation was not helpful at all, do I had to dig back into the UE4 code to try to figure out how to add keys.
In the middle of reading 4 or 5 Update methods with very intuitive names I found and Update method which finally allows me to add Keys and finally solve what could have been a very strait forward process.
In short here is my final solution:
UE4 Engine suggestions for improvement:
answered Jan 04 '17 at 08:56 PM
You can construct a Blackboard asset in the content manager without using BT. It's a separate asset type and is associated with BTs only for convenience. You need to build such an asset and use it to initialize your BB.
answered Jan 03 '17 at 12:53 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here