RealDocs

UBlackboardComponent::HasValidAsset

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

Description

Returns true if the component currently has a valid, initialized blackboard data asset assigned.

Caveats & Gotchas

  • Check this before calling key lookups on a freshly spawned component — GetKeyID/GetKeyName silently return invalid results if no asset is set yet.
  • Becomes true only after InitializeBlackboard succeeds or InitializeComponent runs with a DefaultBlackboardAsset configured.

Signature

bool HasValidAsset() const

Return Type

bool

Example

Guard against an uninitialized blackboard C++
if (BlackboardComp->HasValidAsset())
{
    BlackboardComp->SetValueAsBool(TEXT("IsAlerted"), true);
}

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.