Behavior tree restarts when disabling it

xxchester

New member
Hello, I am trying to stop a behavior tree from executing once the enemy is dead. I have tried to set the behavior to false via tree.enabled = false and also tried the tree.DisableBehavior() API with and without the pause flag. They all just restart my tree and I cannot figure out why. I don't have Restart When Complete enabled.

Here is a screenshot:
1676213204054.png

In the designer I can see the tree restarts.

Any ideas or suggestions?
Thanks.
 
You should call tree.DisableBehavior(true) in this situation. This will pause the behavior tree at the current node until it is resumed with tree.EnableBehavior().
 
I'm glad that it's working now, though I do wonder what caused it. For completeness here's an example of it resuming from the paused location -
 

Attachments

  • PauseResume.unitypackage
    3.6 KB · Views: 0
Top