RealDocs

AAIController::BrainComponent

property AIModule Blueprint Since 4.0
#include "AIController.h"
Access: public Specifiers: UPROPERTYBlueprintReadWrite

Description

The component responsible for driving this controller's AI logic, typically a UBehaviorTreeComponent. Set automatically when RunBehaviorTree is called.

Caveats & Gotchas

  • Exposed as BlueprintReadWrite, so Blueprint subclasses can accidentally null it out or replace it with an incompatible type. Prefer GetBrainComponent() in C++ for read access to avoid the risk of acting on a blueprint-mutated value.
  • Only exists on the server in multiplayer — AIControllers do not exist on clients by default. Any code unconditionally reading BrainComponent on a non-server machine will dereference a null pointer.

Signature

TObjectPtr<UBrainComponent> BrainComponent

Examples

Pause the AI brain component during a cutscene Blueprint
Event BeginPlay Cast To AAIController Object Cast Failed As AI Controller As AI Controller Pause Logic Target is Brain Component Target Reason Cutscene Cutscene Get Controller Target is Pawn Return Value Return Value Get Brain Component Target is AI Controller Target Brain Component Brain Component
Edit Blueprint graph Pause the AI brain component during a cutscene
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
Pause AI logic around a cutscene C++
void AMyAIController::OnCutsceneStarted()
{
	if (BrainComponent)
	{
		BrainComponent->PauseLogic(TEXT("Cutscene"));
	}
}

Tags

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.