Editor Graph

The editor graph works and look pretty much like the Animator graph, this is the editor for the State Machines they are composed of nodes with Actions, Triggers and Transitions where you can add Conditions.

The State Machine asset

To create a Behavior Graph asset right click on your Project Panel and select Create → Game Creator → State Machine. You can name it however you want as well as place it anywhere.

I recommend creating a State Machines/ folder at the root of your project and organize all your trees there.

State Machines can be duplicated by simply selecting the SM asset and press CTRL+D

The Controller

In order to run a State Machine you have to use a State Machine Controller component. You can add it manually to a Game Object or simply drag and drop a State Machine asset in an object this will auto-create a State Machine Controller and assign the State Machine reference.

The State Machine Graph Window

To bring up the StateMachine Graph window simply go to the top toolbar and select Window → State Machine. Alternatively, when you double click on a State Machine asset it will automatically open the window.

Live debugging

When playing Unity you can preview where the State Machine is currently running.

Context Menus

Once you right click somewhere in the Graph it will show a different context menu depending on what you have selected.

Export

One neat feature of the State Machine is that you can easily export them to re-use them on other projects.

This option will package a SM in a Unity Package containing the SM with all its nodes, actions, conditions and triggers.

Last updated