Writing Custom State Behaviours
using Ilumisoft.VisualStateMachine;
using UnityEngine;
/// <summary>
/// Derive from StateBehaviour to execute custom logic when a state is executed.
/// </summary>
public class MenuStateBehaviourExample : StateBehaviour
{
/// <summary>
/// The id of the state the behviour should act on
/// </summary>
public override string StateID => "Menu";
protected override void OnEnterState()
{
// Execute something when the state is entered
Debug.Log($"On Enter State: '{StateID}'");
}
protected override void OnExitState()
{
// Execute something when the state is exited
Debug.Log($"On Exit State: '{StateID}'");
}
protected override void OnUpdateState()
{
// Execute something when the state is updated...
}
}

Last updated