void Awake() { if (instance == null || instance.Equals(null)) { instance = this; if (OnEnter == null || OnEnter.Equals(null)) { OnEnter = new Dictionary <State, System.Action>(); foreach (State action in System.Enum.GetValues(typeof(State))) { OnEnter[action] = null; } } if (OnExit == null || OnExit.Equals(null)) { OnExit = new Dictionary <State, System.Action>(); foreach (State action in System.Enum.GetValues(typeof(State))) { OnExit[action] = null; } } } else { Destroy(gameObject); } }