10. Behavior Tree Basics

The Root node starts the tree, and all other nodes connect below it.

root.png

It can only have one output connection. The darker bar on the bottom of the node is like a pin in Blueprint that you can drag off to connect to other nodes:

connectNodes.png

However, unlike Blueprint node pins which allow you to drag connections from either output to input, or input to output, Behavior Tree nodes are directional: you must drag from an "output bar" to an "input bar."

Steps

selAndSeq.png

  1. Open your Behavior Tree asset, if it is not open already, by Double-clicking it in the Content Browser.

  2. In Behavior Tree mode, Right-click in the graph area and create two Composites -> Selector nodes.

    selector.png

  3. In Behavior Tree mode, Right-click in the graph area and create a Composites -> Sequence node.

    sequence.png

These are the 2 primary decision making nodes available for Behavior Trees. The Selector node will run through its children, from left to right, until one of them succeeds, at which point it will fail back up the tree. While the Sequence node will run through its children from left to right until one of them fails, at which point it will fail back up the tree.

While Selector and Sequence nodes will have a number of children under them, the Root node can only have one node attached to it.

connected.png