public void Start(string key) { if (_currentState != null) { GameObject.RemoveGameObjectComponent(_currentState); _currentState.Dispose(); } _currentStateInfo = _stateInfo[key]; _currentState = Activator.CreateInstance(_currentStateInfo.Type) as Behavior; GameObject.AddGameObjectComponent(_currentState); }