예제 #1
0
        public virtual IEnumerator UnityTearDown()
        {
            if (CentralAutomationController.Exists())
            {
                CentralAutomationController.Instance.Reset();
            }
            if (RecordedPlaybackController.Exists())
            {
                RecordedPlaybackController.Instance.Reset();
            }

            if (RecordedTesting.IsRecordedTest(testName))
            {
                ReportingManager.CreateMonitoringService();
            }

            int    sceneCount = 0;
            string sceneName  = string.Empty;

            while (true)
            {
                bool sceneExists = false;
                sceneName = "emptyscene" + sceneCount++;
                for (int x = 0; x < SceneManager.sceneCount; x++)
                {
                    if (SceneManager.GetSceneAt(x).name == sceneName)
                    {
                        sceneExists = true;
                    }
                }
                if (!sceneExists)
                {
                    break;
                }
            }

            var emptyScene = SceneManager.CreateScene(sceneName);

            SceneManager.SetActiveScene(emptyScene);
            yield return(UnloadScenesExcept(emptyScene.name));
        }