Might be a old post but since it’s the first result popping on google for running a behaviour tree in C++ I will share what I did. In a class file that inherit ACharacter ( could also be APawn I guess), in the BeginPlay() overridden function you can do something like this.
void AAIMinionActor::BeginPlay()
{
Super::BeginPlay();
AAIController * AIC = UAIBlueprintHelperLibrary::GetAIController(this);
AIC->RunBehaviorTree(this->BehaviorTree); // Obviously this will crash if BehaviorTree is nullptr
}
“this->BehaviorTree” is a UPROPERTY you have to set in your AI Blueprint. You have to set “Auto Possess AI” to “Spawned”.
Useful doc :
Cheers