How to Reset BehaviorTree

Jyuara

New member
After BehaviorTreeReference replaced by ExternalBehaviorTree , I disabled and renabled the whole tree. But the BehaviorTreeReference didn't reset.
What is the corret way to reset it via script?
a1.png ->after replace , disable , renable->a2.png

I tried this function [ BehaviorManager.instance.DestroyBehavior() ] however the Idle node was still there ,actived.
 
Last edited:
The Behavior Reference gets consumed when the tree starts so in this case you'll want to save your main tree out to an ExternalTree and then when you restart reassign that external tree. This will then preserve the Behavior Reference task.
 
The Behavior Reference gets consumed when the tree starts so in this case you'll want to save your main tree out to an ExternalTree and then when you restart reassign that external tree. This will then preserve the Behavior Reference task.
Thanks Justin, My main tree is already an ExternalTreeAsset. I want to clear the Behavior Reference task.
 
Can you create an instance of that external tree and then copy it? I haven't tested it but I think that this should allow you to keep the reference task.
 
Top