Sequence Node

Jump to: navigation , search

Node Description

Sequence 5 1.png

Sequence Node

A Sequence Node should be used if you want to perform a series of nodes, one after another.

A Sequence Node runs its children in order, from top to bottom.

By default, the stop on failure property in the node inspector is set to false. In this case, a sequence node will run each child in turn regardless of whether the previous child succeeded or failed. Note, in any if an error occurs the sequence node will stop running and return error.

If stop on failure is set to true, the sequence will only continue to run as long as the previously active child returns success when it is finished running. If a child of the sequence node returns failure, the sequence node stops running and returns failure to its parent. If the sequence node has no children, or it’s last child returns success when it finishes, the sequence node returns success. If a child is running, the sequence node returns "running" to its parent.

It is important to remember that when a sequence node has stop on failure set to true and a child which is a Loop If, Loop, or Do If can fail, this will cause the Sequence Node to end without running the remaining children. If you have multiple Loop If, Loop or Do If nodes as children of a Sequence Node and you want to continue running the remaining children even if one returns failure, be sure ‘stop on failure’ is set to false (default).


Node Type

Composite - has 0 or more children, and is typically used to define task structure or logic flow of the behavior tree.

Node Inspector

Sequence Node Inspector v2.png

  • ID
Not editable
  • Name
Auto generated and user editable
  • track cycle time
Determines the cycle time of how long it takes to execute the branch; the time it takes to complete all children contained within the sequence node. When turned on, it will create a variable for the specific Sequence Node in Shared Data.
  • Stop on failure
By default this is set to false meaning that the sequence will continue running the remaining children even if one return failure. If set to true the sequence will end if any child returns failure.
  • Comments
User editable - add comments about this node.



Benefits

  • Use sequence nodes to split the task up into logical branches. For example, place only and all of the nodes related to a pick after a single sequence node. This has several benefits, including:
    • Logically break the task up to make it is easier to follow and understand.
    • The ability to collapse that branch to make it easier to focus on individual sections of the tree.
    • During troubleshooting, disable the sequence node (select disable from the menu after right clicking on the node) of a branch that doesn't need to be run.
    • Adding a sequence node in front a group of nodes that perform a function makes it easier to insert conditional logic later, such as a DO IF node.

Example

Sequence.png