Hi all, I’m fooling around with behavior tree and blackboards in C++, and I’m attempting to keep everything in C++ and away from visual blueprints, and everything goes well except I can’t seem to figure out how to set the blackboard key in the MoveTo task in C++. if I manually set it in the blueprint (please see the image), and everything else remains in C++ (creating sequence, tasks, blackboard, blackboard keys, etc.), everything works as expected.
Well, I extended the BTTask_MoveTo class and put a setter in it that directly updates BlackboardKeySelector’s SelectedKeyName and it seems to be working okay now.
Is this approach acceptable from UE4’s coding standard? Should I tackle it differently? My goal is to have the behavior tree and related items in C++ 100%, and the extended class with the setter helps accomplish this, but I would like to stick with the coding standard, please let me know your thoughts.
Hi, sorry to bother you. I have this same problem but I can’t fit you answer in my code for some reason.
I created my MoveTo task on code, now I’m trying to find a way to set the BlackboardKey in the task. Could you please put the setter you made?
Thank you in advance :).
hi, thank you for your comment, I’m sorry my previous experience is not that helpful to you. As far as I remember, I figured it out by studying %path%\Epic\UE_4.xx\Engine\Source\Developer\AITestSuite\Public\BTBuilder.h (replace with your installation path and xx with your engine subversion). it may also be worth mentioning that eventually I decided to handle BT the visual way and kept C++ only for super custom situations. Hope this helps. Thanks!