Skip to content


State Machines are one of the easiest AI tools to understand and work very intuitively.

There is a starting State node which connects to other State(s) in a specific order. This order can be seen selecting a State node and sorting the transitions at the bottom of the Inspector panel.

State Transitions in a State Machine

When a State is running, depending on the Check field value (which can be Every Cycle or Every Frame) it will check whether it can transition to another State.

The order in which it tries to change to another node is from top to bottom, and will move as soon as it finds a new suitable State that successfully passes its Conditions list.

If not a single connected State successfully passes the Conditions, the transition won't happen and the current State will remain as the running one.


Here's an example of a State Machine with two states: One that makes a character patrol around and one that tracks the player when it's in its line of sight.

State Machine Running

Upon seeing the player, the current Patrol state transitions to the Track Player state. If the guard loses sight of the player, it transitions back to Patrol.