UBehaviorTreeComponent::GetRootTree
#include "BehaviorTree/BehaviorTreeComponent.h"
Access: public
Specifiers: const
Description
Returns the behavior tree asset at the bottom of the instance stack — the tree that was originally started with StartTree, regardless of any dynamic subtrees pushed on top of it.
Caveats & Gotchas
- • Returns null if the instance stack is empty, same as GetCurrentTree.
- • Use this instead of GetCurrentTree when you need the outermost tree asset for identification purposes (e.g. logging which behavior an AI was assigned), since GetCurrentTree can point at a pushed subtree instead.
Signature
UBehaviorTree* GetRootTree() const Return Type
UBehaviorTree* Example
Identifying the originally started tree C++
UBehaviorTree* RootAsset = BTComponent->GetRootTree();
ensure(RootAsset == AssignedBehaviorTreeAsset); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?