Learn how to use NodeCanvas

FSM Callbacks

When an FSM state is Entered, Updated or Exited, you can receive callbacks on your MonoBehaviours attached to the same game object as the FSMOwner. The callbacks that can be used are the following:

  • OnStateEnter(IState)
  • OnStateUpdate(IState)
  • OnStateExit(IState)

To do so, you need to implement the ‘IStateCallbackReceiver’ interface in your MonoBehaviour. Here is a code example for your convenience.

IState is an interface having information about the current state the callback is called for.

These callbacks are not meant to be used for modeling a whole state, but rather to get notified and perform some extra actions you might need to do.

Yes No Suggest edit
12 of 12 users found this section helpful
Suggest Edit