# 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.**

![Example of a Connection Manager which takes care of room creation and player instantiation](/files/-MTMERDi0syzKuX2G-Ix)

## 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.

{% hint style="success" %}
I recommend creating a **`State Machines/`** folder at the root of your project and organize all your trees there.
{% endhint %}

{% hint style="success" %}
**State Machines** can be duplicated by simply selecting the SM asset and press **CTRL+D**
{% endhint %}

## 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.

![](/files/-MTTVe1g4zIqVDVx-u7L)

## 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.

![(A state machine with a transition selected)](/files/-MTMHMyNRX6VMJonrSln)

## Live debugging

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

![](/files/-MTMFZF2bEMB6gwODD1N)

## Context Menus

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

![](/files/-MTMU_Uu6QG2jq_ymX91)

## Export

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

![](/files/-MTT1Al-Zln-BNpqslmu)

{% hint style="info" %}
This option will package a SM in a Unity Package containing the SM with all its nodes, actions, conditions and triggers.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ninjutsugames.com/game-creator-1/state-machine/editor-graph.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
