A game about forced loneliness, made by TACStudios
1using System;
2using System.Collections;
3using UnityEditor.SceneManagement;
4using UnityEngine.SceneManagement;
5
6namespace UnityEditor.TestTools.TestRunner.TestRun.Tasks.Scene
7{
8 internal class RemoveAdditionalUntitledSceneTask : TestTaskBase
9 {
10 internal Func<int> GetSceneCount = () => SceneManager.sceneCount;
11 internal Func<int, ISceneWrapper> GetSceneAt = i => new SceneWrapper(SceneManager.GetSceneAt(i));
12 internal Func<ISceneWrapper, bool, bool> CloseScene = (scene, remove) => EditorSceneManager.CloseScene(scene.WrappedScene, remove);
13 public override IEnumerator Execute(TestJobData testJobData)
14 {
15 var sceneCount = GetSceneCount();
16 if (sceneCount <= 1)
17 {
18 yield break;
19 }
20
21 for (int i = 0; i < sceneCount; i++)
22 {
23 var scene = GetSceneAt(i);
24 if (string.IsNullOrEmpty(scene.path))
25 {
26 CloseScene(scene, true);
27 yield break;
28 }
29 }
30 }
31 }
32}