/*-------------------------------------------------------------------------*/ internal void SetState(StateID stateID) { foreach (FSMState state in stateList) { if (state.ID == stateID) { currentState.OnStateExit(); lastState = currentState; currentState = state; currentState.OnStateEnter(); return; } } Debug.Log("Invalid state or state does not belong to this FSM."); }