public IEnumerator SwitchScene(Type sceneType) { if (!sceneType.IsSubclassOf(typeof(SceneLogic))) { yield break; } if (m_curScene != null) { yield return(m_curScene.BeforeExit()); yield return(m_curScene.OnExit()); } var scene = (SceneLogic)Activator.CreateInstance(sceneType); m_curState = SceneMgrState.Loading; yield return(scene.LoadScene()); yield return(scene.BeforeEnter()); yield return(scene.OnEnter()); m_curScene = scene; m_curState = SceneMgrState.Normal; }