UBehaviorTreeComponent::Cleanup
#include "BehaviorTree/BehaviorTreeComponent.h"
Access: public
Specifiers: virtualoverride
Description
Tears down the running tree: removes all instances, clears node memory, and resets internal execution state. Called internally when the tree stops or the component is uninitialized.
Caveats & Gotchas
- • Not something you'd normally call directly from gameplay code — it's invoked internally by StopTree and UninitializeComponent. Calling it manually mid-execution can leave tasks in an inconsistent state.
- • Overrides UBrainComponent::Cleanup, so a generic BrainComponent pointer will call into this implementation for behavior trees.
Signature
virtual void Cleanup() override; Return Type
void Example
Extend cleanup in a subclass C++
void UMyBehaviorTreeComponent::Cleanup()
{
Super::Cleanup();
// project-specific teardown
CustomSharedBlackboardCache.Reset();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?