How to complete task manually?


New member
I want to stop last active task and start next one. I tried this way, but it makes last task disabled and doesn't start next task. How is it possible to do what I need?

BehaviorDesigner.Runtime.Tasks.Task lastTask = null;

behaviorTree.GetActiveTasks().ForEach(action => {
  lastTask = action

if (lastTask != null) {
  lastTask.Disabled = true;


Staff member
Arbitrarily stopping and starting tasks isn't part of the behavior tree specification so you aren't able to directly do this within the tree traversal. You have a few options:

- Use conditional aborts to reevaluate when the branch should execute
- Use the interrupt task to interrupt a branch. The Perform Interruption task can then interrupt it.
- Create a set of base classes which can return success/failure at any time. This will involve changing the base class for any task that you use but it does sound the most similar to what you are going for.


New member
Thanks for advise!

I started to investigate each of these ways and have a question. Does it true that the only one way to share variable from my script to some task is creation custom task and use shared variable?