public void TestSetMainSceneInBuild()
        {
            var emptyScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene);

            LoadingScreenGenerator.SetMainSceneInBuild(emptyScene.path);

            var scenesWithOurPath = Array.FindAll(EditorBuildSettings.scenes, (scene) => scene.path == emptyScene.path);

            Assert.AreEqual(scenesWithOurPath.Length, 1,
                            "The scene should be present in Build Settings once and only once");

            Assert.IsTrue(scenesWithOurPath[0].enabled,
                          "The scene should be enabled");

            foreach (var scene in EditorBuildSettings.scenes)
            {
                if (scene.path == emptyScene.path)
                {
                    continue;
                }

                Assert.IsFalse(scene.enabled,
                               "All other scenes should be disabled");
            }
        }
Example #2
0
        public void TestSetMainSceneInBuild()
        {
            var scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene);

            LoadingScreenGenerator.SetMainSceneInBuild(scene.path);

            Assert.AreEqual(EditorBuildSettings.scenes.Length, 1,
                            "There should be only one scene in Build Settings.");

            Assert.AreEqual(EditorBuildSettings.scenes[0].path, scene.path,
                            "The new scene built should be identical to the one in Build Settings.");
        }