RealDocs

UBlackboardComponent::GetBrainComponent

function AIModule Since 4.0
#include "BehaviorTree/BlackboardComponent.h"
Access: public

Description

Returns the behavior tree (or other brain) component associated with this blackboard, as previously set via CacheBrainComponent.

Caveats & Gotchas

  • Returns nullptr if CacheBrainComponent has never been called for this blackboard instance.
  • The cached pointer is not automatically cleared if the owning brain component is destroyed; check for validity before dereferencing in long-lived code.

Signature

UBrainComponent* GetBrainComponent() const

Return Type

UBrainComponent*

Example

Query the owning brain component C++
if (UBrainComponent* Brain = BlackboardComp->GetBrainComponent())
{
    Brain->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.