AAIController::BrainComponent
#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
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?