State Machine

A finite state machine (SM) used for simplifying creation of gameplay logic or A.I. behavior. It must be created in class that derived from Monobehaviour by pressing ‘Add state machine’ button:



State machine change node (state) to other through links (transitions) if it passes link condition. State will wait until any first link will pass the condition then transfer to other state. If there are few links pass condition – state will use the first priority link. Entry node it’s an entry point of sequence in state machine.


Transitions have 5 modes for transition:

  • Never – transition is disabled. Can be used for temporary disabling transition;
  • Always – always allow to transit;
  • Conditions – transition allowed if all conditions will be passed. Each condition checks the value of script variable;
  • Code Condition – transition permission based custom script function, which returns bool value;
  • Trigger – based on bool variable. After trigger pass, the value of this variable will be set to false.


‘Switch to Code Condition’ button will check on Code Condition option and opening this function.



Each state and transition has events, which can be used for executing nodes in Nottorus Script Editor:



Nodes events:

  • Do Before Entering – calls before SM enter to this node;
  • Do Before Leaving – calls before SM leaves from this node;
  • State Loop – calls while SM stay in this node (waiting for any link will pass condition). Will not be called if SM enters to node which has any out link that pass the condition.

Transition events:

  • On Start Transit – calls before SM will use this link for transition;
  • On End Transit – calls after SM ends transition using this transition;
  • Transition Loop – calls while SM transit using this link (if transition has ‘Transition time’ option) and gives transition delta value.
Render time: 0.01 seconds
137,002 unique visits