BrainComponent is not initialized if RunBehaviorTree is not called

I was playing with BT Tasks in C++ and I found out that my BrainComponent is always null.

The Controller I was working on is a sublcass of AAIController that has its own reference to a BehaviourTree implemented through a default subobject:

BehaviorComp = CreateDefaultSubobject<UBehaviorTreeComponent>(TEXT("BehaviorComp"));

To run a behaviour tree on this component I use StartTree:


Checking Unreal Engine source I can see that the BrainComponent is initialized inside the RunBehaviorTree function of AAIController while the StartTree doesn’t refer to BrainComponent and in general it seems there are no calls to the AAIController owner.

Is it possible that the BrainComponent is initialzied only through Blueprints, using RunBehaviourTree? In this case would it be a good Idea to manually initialize the BrainComponent when I start the BehaviorTree?