UBehaviorTreeComponent::FindTemplateNode
#include "BehaviorTree/BehaviorTreeComponent.h"
Access: public
Specifiers: const
Description
Given an instanced runtime node, returns the shared template node it was created from. Behavior tree assets are shared between instances, so per-instance nodes reference a common template for static data.
Caveats & Gotchas
- • Returns nullptr if the node has no matching template in the current instance stack (e.g. it belongs to a subtree that has since been removed).
- • The returned template node is shared across all AI using the same tree asset — never write to it as if it were per-instance state.
Signature
UBTNode* FindTemplateNode(const UBTNode* Node) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Node | const UBTNode* | Instanced node whose shared template node should be located. | — |
Return Type
UBTNode* Example
Looking up the template for an instanced node C++
if (UBTNode* Template = OwnerComp.FindTemplateNode(InstancedNode))
{
UE_LOG(LogBehaviorTree, Log, TEXT("Template: %s"), *Template->GetNodeName());
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?