Simple State Machine


Component Name See networking.


Auto Bind To UI If enabled, state machine will automatically attach to Toggles, Buttons,Sliders, and Dropdowns on the same object at runtime.

If you have a slider with a range of like 1 to 10, you can create 10 states called 1, 2, 3, 4, etc and it'll switch between them automatically as you move the slider around.

You can skip numbers too.

If you have 1, 3, 7, 10, then basically 1,2 will use the '1' state, 3,4,5,6 will use the '3' state, 7,8,9 will use the '7' state, and 10 will be itself.

If there's no exact state match, and you are in between numbers, it rounds down to the nearest available state.

You can also call StateMachine.BindUI(object) to bind it to UI elements on some other object, 'auto bind' only works if there's something on the same object.


NetworkedState If enabled, state machine will network its state to all other users in the scene persistently that have the same component name.

NetworkedUnique If enabled, state machines on different objects will not work together even if they have the same component name.

State Settings

Start State 0 or 1 will be the first state in the list as default. States are 1-based, so 1 is the first state in the list.

Wrap States When reaching the last state, does it wrap back around to first state again (and vice versa).

Exit State On Start Automatically run the Exit Event on all states except the start state when component starts.

Redo States If told to switch to the state it is already in, redo the events anyway.

State Events

StateChangeEvent Event that happens every time the state changes, no matter what state it is coming to or from.

Machine States A simple state machine typically consists of a set of states, events that trigger state transitions, and actions that are performed upon entering or leaving a state.

Last updated

Sinespace® is a registered trademark of Sine Wave Entertainment Ltd, All Rights Reserved.