Creating State Machine

A state machine is used to visualize different character states and implement the behavior loop from idle to speak.

  1. Wait state.
  2. Idle state.
  3. Listen state.
  4. Speak state.

Follow the instruction below to build these states in the Behavior Tree.

  1. In the Behavior Tree graph, right-click on the empty area and select Composite > State Manager.
  2. A State Manager node is created.


    Select the node to show its corresponding settings in the Parameters section on the right.
  3. Add a state by typing the state name in the text field and clicking on Add to the right. The created state will be added to the list above.
  4. Select the Idle state as the default state from the drop-down list.
  5. To create a state node, right-click on the empty area and select Decorator > State > Define State.
  6. A Define State node is created.


    Select the node to show its corresponding settings in the Parameters section on the right.
  7. Specify a state for the node from the drop-down list.
  8. After creating all state nodes, connect them to the State Manager.
  9. Switch between states to complete the behavior flow.