UBehaviorTreeComponent::GetActiveNode
#include "BehaviorTree/BehaviorTreeComponent.h"
Access: public
Specifiers: const
Description
Returns the currently executing node in the active instance on top of the stack — typically the task currently running.
Caveats & Gotchas
- • Returns null if the instance stack is empty; a running tree with no active task briefly during a search can also momentarily reflect a stale value until the search completes.
- • The returned node is a const pointer — use IsExecutingBranch or FindInstanceContainingNode instead if you need to reason about ancestry rather than just the leaf.
Signature
const UBTNode* GetActiveNode() const Return Type
const UBTNode* Example
Logging the currently active node C++
if (const UBTNode* ActiveNode = BTComponent->GetActiveNode())
{
UE_LOG(LogBehaviorTree, Verbose, TEXT("Active node: %s"), *ActiveNode->GetNodeName());
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?