Running Behaviors One After Another

As explained in Behaviors Main Concepts, Behaviors can be combined together in a Behavior Graph and run one after another thanks to Behavior Triggers.

Create a simple Behavior Graph

To run two Behaviors one after another just drag-and-drop them in a Behavior Container flow.

walk and run Behaviors

Setup Triggers

Then configure Behavior Triggers to start and stop when needed. As explained in the Triggers Main Concepts, a Trigger can be seen as a barrier which stops the flow until a specific event happens in the scene.

With two Behaviors, several cases can be encountered:

- In this case, the first Behavior Stop Trigger is Trigger Container with a Boolean Trigger always false as root. It means that the walk Behavior will never stop, thus the run Behavior will never be played whatever its start Trigger value.

False Stop Trigger on first Behavior
 
Notice that a Behavior stop Trigger default return value is "false". To update it, you can add other Triggers (distance, random....) in the relative Trigger Graph.
 

- Here the first Behavior Stop Trigger will become true during the simulation (for example when a Target has been reached). When the walk Behavior stops the run Behavior will start because its Start Trigger is true. 

True Start Trigger on second Behavior

- Finally in this case, the first Behavior Stop Trigger will also become true during the simulation . When the walk Behavior stops, the flow will be stopped because the Start Trigger of the run Behavior is false. The flow remains stopped until the start Trigger turns true.

False Start Trigger on second Behavior