UBehaviorTreeComponent::GetActiveInstanceIdx
#include "BehaviorTree/BehaviorTreeComponent.h"
Access: public
Specifiers: const
Description
Returns the index of the instance currently on top of the stack — the subtree that owns the active node.
Caveats & Gotchas
- • Index 0 is the root tree; higher indices correspond to subtrees pushed via dynamic subtree injection or RunBehavior tasks.
- • Meaningless when the instance stack is empty — pair with IsInstanceStackEmpty or IsRunning before relying on the value.
Signature
uint16 GetActiveInstanceIdx() const Return Type
uint16 Example
Getting node memory for the active instance C++
const uint16 InstanceIdx = BTComponent->GetActiveInstanceIdx();
uint8* NodeMemory = BTComponent->GetNodeMemory(BTComponent->GetActiveNode(), InstanceIdx); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?