There are 4 types of nodes in Behavior Trees plus a special node called Entry, which is a single node that can't be deleted and marks the root of the execution.
A Task node is in charge of executing a specific set of Instructions when it runs.
It also contains a Conditions list, which is executed every time the graph is evaluated. If their value is not successful and the Instructions list are running it will return a Failure.
While the Instructions are running, the Task node returns Running and upon finishing them it returns Success.
A simple Task
For example if a Task node is a direct child of the Entry node and it waits 1 second before finishing, running the graph will put the whole graph under the Running state and change to Success after one second.
Composite nodes allow to branch and determine the order in which its child nodes are executed. There are multiple types of composites, which can be chosen selecting the Composite node and clicking on the field in the Inspector.
The Selector composite executes the left-most child first. If the conditions return a Success the composite node also returns Success.
However if the child returns Failure it attempts to execute the next child node.
If all nodes return Failure the composite also returns Failure.
Selector as an OR
The Selector composite type can be seen as an OR operator with their children.
The Sequence composite executes the left-most child first and follows to the next if the execution of the previous one is Success.
If the execution of a child node returns Failure the composite node will also return a Failure.
If all nodes return Success the composite also returns Success.
Sequence as an AND
The Sequence composite type can be seen as an AND operator with their children.
The Parallel composite, as its name implies, executes all of its children at the same time and it can configure when the composite should be considered as Success by choosing the option from the field that appears in the Inspector.
For example selecting All Successful will make the composite node return Success if and only if all of its children have finished with a Success result. Otherwise it will return Failure.
The Random Sequence composite works exactly the same way as the Sequence composite, except that the order in which its children are evaluated is chosen at random right before the graph is evaluated.
The Random Selector composite works exactly the same way as the Selector composite, except that the order in which its children are evaluated is chosen at random right before the graph is evaluated.
Decorator nodes don't do anything but can transform the results of its child node. For example, the Invert node returns Success or Failure depending on the value of its child node.
There are also multiple Decorator types of nodes
Returns Failure regardless of the result of its child.
Returns Success regardless of the result of its child.
Returns Running regardless of the result of its child.
Returns Success if its child node is Failure.
Returns Failure if its child node is Success.
Returns Running otherwise.
Returns Running as long as the amount of times that its child has ran is below a specific number.
In other words, allows to execute its child a certain amount of times before returning its last result.
Returns Running as long as its child is either Running or Failure.
Returns Failure otherwise.
Returns Running as long as its child is either Running or Success.
Returns Failure otherwise.
A Sub Graph node allows to execute other Behavior Trees or even other types of AI systems, such as State Machines.
This type of node behaves exactly the same as the Task node, except that instead of executing a collection of Instructions it executes another AI graph.