public void switchState(States newState) { activeState.SaveState(); activeState.CloseState(); switch (newState) { case States.ProjectSelector: activeState = gameObject.AddComponent <ProjectSelectorState>(); break; case States.ProjectEditor: activeState = gameObject.AddComponent <ProjectEditorState>(); break; case States.AnimationEditor: activeState = gameObject.AddComponent <AnimationEditorState>(); break; case States.BatchRenderer: activeState = gameObject.AddComponent <BatchRendererState>(); //TODO: Implement Animation Playback State break; } }