BrainComponent NULL

What determines whether or not an AIController will have access to a valid UBrainComponent?

AAIController* AIController = Cast<AAIController>(TestPawn->Controller);

		if (AIController)
			UBrainComponent* Brain = AIController->GetBrainComponent();

			if (!Brain)
				UE_LOG(LogTemp, Warning, TEXT("No Brain: %s"), *TestPawn->GetName());

I’m finding that GetBrainComponent() returns NULL but I don’t know much about this component or why it would be NULL. What determines where it gets set and how is this component used in the big picture?

Your best bet is to go dig that yourself in the source code; it’s a great exercise and you will always find that you need to deal with similar problems in most C++ projects. We could go dig the source code for you, but you’re going to miss a lot of information and might not get the idea right.

Did you find the issue?
I’m experiencing a similar situation. I’ve just asked a similar question, referring to a possible cause for the BrainComponent null state. BrainComponent is not initialized if RunBehaviorTree is not called - AI - Unreal Engine Forums

According to the AIController’s source code, it only set BrainComponent when using a Behavior Tree via the RunBehaviorTree method. In that case, the BrainComponent will be an instance of UBehaviourTreeComponent.

hey please check my answer, just added it after looking the sources

You are just reporting what I’ve written in my answer. Anyway, I think we should wait for an official answer from someone at epic, in my opinion it sounds very strange that this component is initialized only via Blueprint.