Home / Level & Game Design / State Machine Editor

State Machine Editor

Lay out states like Idle, Patrol, Chase, Attack, Hurt and Dead as cards, connect them with conditions such as player_distance < 120 or hp <= 0, and press play. Move the sliders and fire signals to watch the machine switch states live. The checker finds unreachable states and broken conditions, and the export gives you a ready Godot 4 script, a Unity C# MonoBehaviour, JSON and a diagram.

From any state

Checked before the current state's own arrows, for things like death or getting hit.

Variables

Name, start value, and the slider range for the simulator. state_time is built in: seconds spent in the current state.

Signals

One-shot events such as hit or jump. In a condition a signal is true for one step after it fires.

Project

Your work is saved in this browser automatically.

Drag states by the title. Drag empty space to pan. Scroll to zoom.
    Idle0.0 s

    Pro · The State Machine Editor is part of GameShipKit Pro, with every Pro feature of the other tools. See plans

    Why a state machine

    Most enemies and many players boil down to a handful of states: standing, walking, chasing, attacking, getting hurt and dying. Written as a pile of if statements, that logic gets tangled fast and a new behavior breaks two old ones. A state machine keeps each state on its own card with clear arrows out of it, so you can see at a glance why an enemy suddenly stops chasing or never attacks.

    States, arrows and conditions

    Click a state to edit it on the left. Give it a name, an optional animation that plays when it starts, and notes for what happens on enter, every frame and on exit. Each arrow out of a state has a condition such as player_distance < 120, hp <= 0, state_time > 2 or hit and hp > 0, and a priority. When several arrows are true at once the highest priority wins. Conditions understand and, or, not, the usual comparisons, math and abs, min and max.

    Transitions under From any state are checked first in every state, which is the clean way to send an enemy to Dead or Hurt no matter what it was doing. They never fire into the state the machine is already in.

    Test it live

    The simulator under the board runs the machine ten times a second. Drag the sliders to move the player closer, lower the health or flip a switch, and press a signal button to fire a one-shot event like a hit. The current state lights up on the board and every change is written to the log with the condition that caused it. The checker lists states that can never be reached, states with no way out, conditions that do not parse and names that are not defined.

    Export to your engine

    FormatWhat you get
    Godot 4One GDScript file: an enum of states, your variables as @export fields, a state_changed signal, trigger("hit") for signals, enter, update and exit sections with your notes, and optional AnimationPlayer playback.
    UnityA C# MonoBehaviour with the same structure: public fields for the inspector, a StateChanged event, Trigger("hit") and Animator playback.
    JSONThe whole graph, to drive your own runtime or keep in version control.
    DiagramA PNG of the board and a Mermaid state diagram for your design docs.

    The generated code runs as it is. Fill in the enter and update sections with movement and attacks, set the variables from your game each frame, and the transitions take care of themselves.

    Your work stays yours

    Everything runs in your browser and is saved in it. Editing, testing and saving a project file are free. Code export is part of GameShipKit Pro.

    New tools every weekGet new free tools and game asset packs by email. About twice a month. Unsubscribe in one click.