How to get a Blackboard Object in C++?

I’m trying to convert my BP_GameAIController blueprint (subclass of AIController) to c++ code. I’m really new to unreal c++ programming so I need a little help.

I have a function named AIGetTargetGameChar that gets an object from the blackboard like this:

I created an AIController subclass, added the AIModule to the Build.cs file.

My Behavior tree and blackboard is created using the Editor.
How sould I create a function like this in code? I noticed there is no GetBlackboard function available.

Is there an good i tutorial in c++ available? I could not find one.

Thank you.

Cool, thanks a lot.

Most nodes are real functions in C++ so you can find them by searching in API refrence

It’s a static function so you should call it UAIBlueprintHelperLibrary::GetBlackboard(SomeActor);

If you want to work with C++ I strongly suggest you started looking for functions in header files first. Blackboard getter you’re looking for is UAIBlueprintHelperLibrary::GetBlackboard. If you’re using launcher versions of UE4 you won’t be able to look at the implementation details, so I also encourage you to get full sources from github for the sole purpose of reading code. If you read UAIBlueprintHelperLibrary::GetBlackboard's implementation you’d find out that it boils down to calling FindComponentByClass() on pawn’s controller.

Happy reading and welcome to the demanding yet satisfying world of UE4 C++ coding! :smiley:

Cheers,

–mieszko

1 Like