Gostate is a lightweight Godot plugin that provides a simple node-based hierarchical state machine system.
- Easy to get started - drop a StateMachine into your scene, add a couple of State nodes and pick an initial state. No boilerplate required.
- Organize behaviour visually - group related states and nested machines in the scene tree so your game logic reads like a map.
- Predictable lifecycle - states signal when they become active or inactive so you can hook up animations, sounds, or setup/teardown code without guessing timing.
- Event-driven transitions - wire transitions with send_event(...) from code for quick, readable flow control.
- Lightweight and non-intrusive - small scripts, no external dependencies, and editor-friendly warnings so you spend less time debugging setup.
- Copy the
addons/gostatefolder into your project (it is already structured as a Godot plugin). - See the example scene: addons/gostate/test_scene.tscn.
- Add a
StateMachinenode to your scene. - Add two child
Statenodes under theStateMachineand set theinitial_stateproperty on the machine to one of them. - Add
StateTransitionnodes as children of both or oneStateto define transitions. Configure theto(target state) andtrigger_eventfields. SeeStateTransition. - Trigger transitions by calling
send_event("your_event")on the machine (or propagate events from input handlers inside states).
This plugin is open-source and licensed under MIT License. Feel free to use, modify, and distribute it as needed.
📢 Feedback is welcome! 🚀
