What it is: step-by-step setup of a state machine via StateMachineData (ScriptableObject), transition predicates, and the StateMachineBehaviour component. Logic (states, transitions) lives in the SO; scene object references for conditions are set on the component (Context for conditions).
How to use: follow the steps below: component in the scene → component settings → creating StateMachineData → states and transitions.
Important: a ScriptableObject cannot store references to scene objects — so the SO only configures logic (states, transitions, which property to check), while which GameObject to read is set on the component in the scene (the Context for conditions section).
The same rule applies to actions (StateAction): the SO stores only the action type and a context slot. To enable/disable a scene object, use SetContextGameObjectActiveAction with Context Slot = Owner / Override1..5. The old SetGameObjectActiveAction with a direct GameObject target is kept only for compatibility with old assets.
- Select a GameObject (e.g., a character).
- Add the component: Component -> Neoxider -> Tools -> State Machine Behaviour.
- In
References, assign theStateMachineData.
State Machine Data— reference to the configuration (SO).- Context for conditions — array of scene GameObjects for transition conditions. Element 0 = slot Override1, element 1 = Override2, … (up to 5). Scene references are set only here, not in the SO.
Auto Evaluate Transitions— automatic transition evaluation every frame.Show State In Insp— display the current state in the inspector.Enable Debug Log— transition logging.Exit Current State On Disable— when the component is disabled, callOnExitof the current state and clear the current state.Reload Data On Enable— reloadStateMachineDatawhen the component is re-enabled.
The Events section:
On InitializedOn State EnteredOn State ExitedOn State Changed(from,to)On Transition Evaluated(transitionName,result)
The Controls section:
Reload DataEvaluate NowGo To Initial StateChange State(manual state selection from the list)
Select the StateMachineData asset and configure:
- Add list elements.
- Assign a
StateDatato each element. - In the
StateData, configure theOn Enter,On Update,On Exitactions.
- Set the starting
StateData.
- Add transitions with the
Add Transitionbutton. - For each transition, fill in:
NameFrom StateTo StatePriorityIs Enabled
- Click
Edit Conditionsto configure the conditions.
Conditions determine when a transition from one state to another is allowed. Without conditions, a transition is considered always available (fires first by priority).
- In the
StateMachineDataasset, click Edit Conditions on the desired transition. - In the Edit Transition window, click Add Condition → Neoxider/Condition Entry.
- Configure the predicate using only data in the SO:
- Context Slot — which object to read from: Owner = the object with the
StateMachineBehaviour; Override1 … Override5 = elements from the Context for conditions list on the component in the scene (indices 0…4). The SO stores only the slot number, not a scene reference. - Condition Entry — same as in NeoCondition: leave Source Object empty (the context from the slot will be used), select the Component and Property, an operator, and a threshold.
- Context Slot — which object to read from: Owner = the object with the
Scene object references are set on the component in the inspector: the Context for conditions section — drag the needed GameObjects there (e.g., the player, an enemy, a point). In the conditions in the SO, select Override1, Override2, etc., to use those objects.
All conditions of a transition are combined with AND logic.
A ConditionEntry can read properties of the StateMachineBehaviourBase component:
CurrentStateName(string)PreviousStateName(string)CurrentStateElapsedTime(float)StateChangeCount(int)HasCurrentState(bool)
Example (in a Condition Entry in the SO):
- Context Slot = Owner
- Source Object = empty
- Source Mode = Component, Component = StateMachineBehaviourBase, Property = CurrentStateName
- Compare = Equal, Threshold String = "Run"
- Context Slot = Owner — reads from the object hosting the StateMachine. For a different object: add that object to Context for conditions on the component in the scene and select Override1 (or Override2, … by index) in the condition.
- In the Condition Entry, leave Source Object empty — the context will come from the slot. Fill in only Component, Property, Compare, and the threshold.
- Make sure the transition's From State and To State match states in the States list.
- Enable Enable Debug Log and watch the console; On Transition Evaluated shows the result of the transition check.
- If logging is disabled, the StateMachine writes no runtime warnings/logs/errors to the console; use
On Transition Evaluatedand Events for UI/tools.
idleandrun— twoStateDataassets.- Transition
idle -> run: conditionSpeed > 0. - Transition
run -> idle: conditionSpeed <= 0. Auto Evaluate Transitions = ON.
| What to do | Where |
|---|---|
| Attach the state machine to an object | StateMachineBehaviour |
| Assign the configuration | References -> State Machine Data |
| Enable auto transitions | Settings -> Auto Evaluate Transitions |
| Configure states | StateMachineData -> States |
| Configure transitions | StateMachineData -> Transitions |
| Configure conditions | On a transition, click Edit Conditions → Add Condition → Neoxider Condition |
| Which object a condition reads from | Context Slot in the condition (Owner / Override1..5); objects for Override — in Context for conditions on the component in the scene |
| Subscribe to events | StateMachineBehaviour -> Events |
| Manual debugging | StateMachineBehaviour -> Controls (in Play Mode) |