static void ProcessSceneParents(
            LoadedSceneInfo sceneInfo,
            Dictionary <string, LoadedSceneInfo> contractMap,
            Dictionary <string, string> defaultContractsMap)
        {
            foreach (var parentContractName in sceneInfo.SceneContext.ParentContractNames)
            {
                LoadedSceneInfo parentInfo;

                if (contractMap.TryGetValue(parentContractName, out parentInfo))
                {
                    ValidateParentChildMatch(parentInfo, sceneInfo);
                    continue;
                }

                parentInfo = LoadDefaultSceneForContract(sceneInfo, parentContractName, defaultContractsMap);

                AddToContractMap(contractMap, parentInfo);

                EditorSceneManager.MoveSceneBefore(parentInfo.Scene, sceneInfo.Scene);

                ValidateParentChildMatch(parentInfo, sceneInfo);

                ProcessScene(parentInfo, contractMap, defaultContractsMap);
            }
        }
        /// <summary>
        /// Attempts to load scene in editor using a scene object reference.
        /// </summary>
        /// <param name="sceneObject">Scene object reference.</param>
        /// <param name="setAsFirst">Whether to set first in the heirarchy window.</param>
        /// <param name="editorScene">The loaded scene.</param>
        /// <returns>True if successful.</returns>
        public static bool LoadScene(SceneInfo sceneInfo, bool setAsFirst, out Scene editorScene)
        {
            editorScene = default(Scene);

            try
            {
                editorScene = EditorSceneManager.GetSceneByName(sceneInfo.Name);

                if (editorScene.isLoaded)
                {   // Already open - no need to do anything!
                    return(true);
                }

                string scenePath = AssetDatabase.GetAssetOrScenePath(sceneInfo.Asset);
                EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Additive);

                if (setAsFirst && EditorSceneManager.loadedSceneCount >= 1)
                {   // Move the scene to first in order in the heirarchy
                    Scene nextScene = EditorSceneManager.GetSceneAt(0);
                    EditorSceneManager.MoveSceneBefore(editorScene, nextScene);
                }
            }
            catch (InvalidOperationException)
            {
                // This can happen if we're trying to load immediately upon recompilation.
                return(false);
            }
            catch (ArgumentException)
            {
                // This can happen if the scene is an invalid scene and we try to SetActive.
                return(false);
            }
            catch (NullReferenceException)
            {
                // This can happen if the scene object is null.
                return(false);
            }
            catch (MissingReferenceException)
            {
                // This can happen if the scene object is null.
                return(false);
            }

            return(true);
        }
        private DragAndDropVisualMode DoDragScenes(GameObjectTreeViewItem parentItem, GameObjectTreeViewItem targetItem, bool perform, TreeViewDragging.DropPosition dropPos)
        {
            List <Scene> list  = DragAndDrop.GetGenericData("SceneHeaderList") as List <Scene>;
            bool         flag  = list != null;
            bool         flag2 = false;

            if (!flag && DragAndDrop.objectReferences.Length > 0)
            {
                int num = 0;
                UnityEngine.Object[] objectReferences = DragAndDrop.objectReferences;
                for (int i = 0; i < objectReferences.Length; i++)
                {
                    UnityEngine.Object @object = objectReferences[i];
                    if (@object is SceneAsset)
                    {
                        num++;
                    }
                }
                flag2 = (num == DragAndDrop.objectReferences.Length);
            }
            if (!flag && !flag2)
            {
                return(DragAndDropVisualMode.None);
            }
            if (perform)
            {
                List <Scene> list2 = null;
                if (flag2)
                {
                    List <Scene>         list3             = new List <Scene>();
                    UnityEngine.Object[] objectReferences2 = DragAndDrop.objectReferences;
                    for (int j = 0; j < objectReferences2.Length; j++)
                    {
                        UnityEngine.Object assetObject = objectReferences2[j];
                        string             assetPath   = AssetDatabase.GetAssetPath(assetObject);
                        Scene scene = SceneManager.GetSceneByPath(assetPath);
                        if (SceneHierarchyWindow.IsSceneHeaderInHierarchyWindow(scene))
                        {
                            this.m_TreeView.Frame(scene.handle, true, true);
                        }
                        else
                        {
                            bool alt = Event.current.alt;
                            if (alt)
                            {
                                scene = EditorSceneManager.OpenScene(assetPath, OpenSceneMode.AdditiveWithoutLoading);
                            }
                            else
                            {
                                scene = EditorSceneManager.OpenScene(assetPath, OpenSceneMode.Additive);
                            }
                            if (SceneHierarchyWindow.IsSceneHeaderInHierarchyWindow(scene))
                            {
                                list3.Add(scene);
                            }
                        }
                    }
                    if (targetItem != null)
                    {
                        list2 = list3;
                    }
                    if (list3.Count > 0)
                    {
                        Selection.instanceIDs = (from x in list3
                                                 select x.handle).ToArray <int>();
                        this.m_TreeView.Frame(list3.Last <Scene>().handle, true, false);
                    }
                }
                else
                {
                    list2 = list;
                }
                if (list2 != null)
                {
                    if (targetItem != null)
                    {
                        Scene scene2 = targetItem.scene;
                        if (SceneHierarchyWindow.IsSceneHeaderInHierarchyWindow(scene2))
                        {
                            if (!targetItem.isSceneHeader || dropPos == TreeViewDragging.DropPosition.Upon)
                            {
                                dropPos = TreeViewDragging.DropPosition.Below;
                            }
                            if (dropPos == TreeViewDragging.DropPosition.Above)
                            {
                                for (int k = 0; k < list2.Count; k++)
                                {
                                    EditorSceneManager.MoveSceneBefore(list2[k], scene2);
                                }
                            }
                            else if (dropPos == TreeViewDragging.DropPosition.Below)
                            {
                                for (int l = list2.Count - 1; l >= 0; l--)
                                {
                                    EditorSceneManager.MoveSceneAfter(list2[l], scene2);
                                }
                            }
                        }
                    }
                    else
                    {
                        Scene sceneAt = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
                        for (int m = list2.Count - 1; m >= 0; m--)
                        {
                            EditorSceneManager.MoveSceneAfter(list2[m], sceneAt);
                        }
                    }
                }
            }
            return(DragAndDropVisualMode.Move);
        }
Пример #4
0
        /// <summary>
        /// If a manager scene is being used, this loads the scene in editor and ensures that an instance of the MRTK has been added to it.
        /// </summary>
        private void EditorUpdateManagerScene()
        {
            if (!profile.UseManagerScene || !profile.EditorManageLoadedScenes)
            {   // Nothing to do here.
                return;
            }

            if (EditorSceneUtils.LoadScene(profile.ManagerScene, true, out Scene scene))
            {
                // If we're managing scene hierarchy, move this to the front
                if (profile.EditorEnforceSceneOrder)
                {
                    Scene currentFirstScene = EditorSceneManager.GetSceneAt(0);
                    if (currentFirstScene.name != scene.name)
                    {
                        EditorSceneManager.MoveSceneBefore(scene, currentFirstScene);
                    }
                }

                if (Time.realtimeSinceStartup > managerSceneInstanceCheckTime)
                {
                    managerSceneInstanceCheckTime = Time.realtimeSinceStartup + managerSceneInstanceCheckInterval;
                    // Check for an MRTK instance
                    bool foundToolkitInstance = false;

                    try
                    {
                        foreach (GameObject rootGameObject in scene.GetRootGameObjects())
                        {
                            MixedRealityToolkit instance = rootGameObject.GetComponent <MixedRealityToolkit>();
                            if (instance != null)
                            {
                                foundToolkitInstance = true;
                                // If we found an instance, and it's not the active instance, we probably want to activate it
                                if (instance != MixedRealityToolkit.Instance)
                                {   // The only exception would be if the new instance has a different profile than the current instance
                                    // If that's the case, we could end up ping-ponging between two sets of manager scenes
                                    if (!instance.HasActiveProfile)
                                    {   // If it doesn't have a profile, set it to our current profile
                                        instance.ActiveProfile = MixedRealityToolkit.Instance.ActiveProfile;
                                    }
                                    else if (instance.ActiveProfile != MixedRealityToolkit.Instance.ActiveProfile)
                                    {
                                        Debug.LogWarning("The active profile of the instance in your manager scene is different from the profile that loaded your scene. This is not recommended.");
                                    }
                                    else
                                    {
                                        Debug.LogWarning("Setting the manager scene MixedRealityToolkit instance to the active instance.");
                                        MixedRealityToolkit.SetActiveInstance(instance);
                                    }
                                }
                                break;
                            }
                        }
                    }
                    catch (Exception)
                    {
                        // This can happen if the scene isn't valid
                        // Not an issue - we'll take care of it on the next update.
                        return;
                    }

                    if (!foundToolkitInstance)
                    {
                        GameObject          mrtkGo          = new GameObject("MixedRealityToolkit");
                        MixedRealityToolkit toolkitInstance = mrtkGo.AddComponent <MixedRealityToolkit>();

                        try
                        {
                            SceneManager.MoveGameObjectToScene(mrtkGo, scene);
                            // Set the scene as dirty
                            EditorSceneManager.MarkSceneDirty(scene);
                        }
                        catch (Exception)
                        {
                            // This can happen if the scene isn't valid
                            // Not an issue - we'll take care of it on the next update.
                            // Destroy the new manager
                            GameObject.DestroyImmediate(mrtkGo);
                            return;
                        }

                        MixedRealityToolkit.SetActiveInstance(toolkitInstance);
                        Debug.LogWarning("Didn't find a MixedRealityToolkit instance in your manager scene. Creating one now.");
                    }
                }
            }
            else
            {
                Debug.Log("Couldn't load manager scene!");
            }
        }
        private DragAndDropVisualMode DoDragScenes(GameObjectTreeViewItem parentItem, GameObjectTreeViewItem targetItem, bool perform, DropPosition dropPos)
        {
            // We allow dragging SceneAssets on any game object in the Hierarchy to make it easy to drag in a Scene from
            // the project browser. If dragging on a game object (not a sceneheader) we place the dropped scene
            // below the game object's scene

            // Case: 1
            List <Scene> scenes = DragAndDrop.GetGenericData(kSceneHeaderDragString) as List <Scene>;
            bool         reorderExistingScenes = (scenes != null);

            // Case: 2
            bool insertNewScenes = false;

            if (!reorderExistingScenes && DragAndDrop.objectReferences.Length > 0)
            {
                int sceneAssetCount = 0;
                foreach (var dragged in DragAndDrop.objectReferences)
                {
                    if (dragged is SceneAsset)
                    {
                        sceneAssetCount++;
                    }
                }
                insertNewScenes = (sceneAssetCount == DragAndDrop.objectReferences.Length);
            }

            // Early out if not case 1 or 2
            if (!reorderExistingScenes && !insertNewScenes)
            {
                return(DragAndDropVisualMode.None);
            }

            if (perform)
            {
                List <Scene> scenesToBeMoved = null;
                if (insertNewScenes)
                {
                    List <Scene> insertedScenes = new List <Scene>();
                    foreach (var sceneAsset in DragAndDrop.objectReferences)
                    {
                        string scenePath = AssetDatabase.GetAssetPath(sceneAsset);
                        Scene  scene     = SceneManager.GetSceneByPath(scenePath);
                        if (SceneHierarchy.IsSceneHeaderInHierarchyWindow(scene))
                        {
                            m_TreeView.Frame(scene.handle, true, true);
                        }
                        else
                        {
                            bool unloaded = Event.current.alt;
                            if (unloaded)
                            {
                                scene = EditorSceneManager.OpenScene(scenePath, OpenSceneMode.AdditiveWithoutLoading);
                            }
                            else
                            {
                                scene = EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Additive);
                            }

                            if (SceneHierarchy.IsSceneHeaderInHierarchyWindow(scene))
                            {
                                insertedScenes.Add(scene);
                            }
                        }
                    }
                    if (targetItem != null)
                    {
                        scenesToBeMoved = insertedScenes;
                    }

                    // Select added scenes and frame last scene
                    if (insertedScenes.Count > 0)
                    {
                        Selection.instanceIDs = insertedScenes.Select(x => x.handle).ToArray();
                        m_TreeView.Frame(insertedScenes.Last().handle, true, false);
                    }
                }
                else // reorderExistingScenes
                {
                    scenesToBeMoved = scenes;
                }

                if (scenesToBeMoved != null)
                {
                    if (targetItem != null)
                    {
                        Scene dstScene = targetItem.scene;
                        if (SceneHierarchy.IsSceneHeaderInHierarchyWindow(dstScene))
                        {
                            if (!targetItem.isSceneHeader || dropPos == DropPosition.Upon)
                            {
                                dropPos = DropPosition.Below;
                            }

                            if (dropPos == DropPosition.Above)
                            {
                                for (int i = 0; i < scenesToBeMoved.Count; i++)
                                {
                                    EditorSceneManager.MoveSceneBefore(scenesToBeMoved[i], dstScene);
                                }
                            }
                            else if (dropPos == DropPosition.Below)
                            {
                                for (int i = scenesToBeMoved.Count - 1; i >= 0; i--)
                                {
                                    EditorSceneManager.MoveSceneAfter(scenesToBeMoved[i], dstScene);
                                }
                            }
                        }
                    }
                    else
                    {
                        Scene dstScene = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
                        for (int i = scenesToBeMoved.Count - 1; i >= 0; i--)
                        {
                            EditorSceneManager.MoveSceneAfter(scenesToBeMoved[i], dstScene);
                        }
                    }
                }
            }

            return(DragAndDropVisualMode.Move);
        }
Пример #6
0
    private static void OpenMultiScene(MultiScene obj, bool additive)
    {
        Scene activeScene = default;

        if (additive || EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
        {
            List <string> firstUnloadedScenes   = new List <string>();
            bool          inFirstUnloadedScenes = true;
            Scene         firstLoadedScene      = default;

            foreach (MultiScene.SceneInfo info in obj.sceneAssets)
            {
                if (info.asset == null)
                {
                    continue;
                }

                string        path          = AssetDatabase.GetAssetPath(((SceneAsset)info.asset).GetInstanceID());
                OpenSceneMode mode          = OpenSceneMode.Single;
                bool          isActiveScene = (SceneAsset)info.asset == obj.activeScene;

                bool exitedFirstUnloadedScenes = false;
                if (inFirstUnloadedScenes)
                {
                    if (!isActiveScene && !info.loadScene)
                    {
                        firstUnloadedScenes.Add(path);
                        continue;
                    }

                    inFirstUnloadedScenes     = false;
                    exitedFirstUnloadedScenes = true;
                }

                if ((!exitedFirstUnloadedScenes) || additive)
                {
                    mode = ((!additive && isActiveScene) || info.loadScene)
                                                ? OpenSceneMode.Additive
                                                : OpenSceneMode.AdditiveWithoutLoading;
                }

                Scene scene = EditorSceneManager.OpenScene(path, mode);

                if (isActiveScene)
                {
                    activeScene = scene;
                }
                if (exitedFirstUnloadedScenes)
                {
                    firstLoadedScene = scene;
                }
            }

            foreach (string path in firstUnloadedScenes)
            {
                Scene scene = EditorSceneManager.OpenScene(path, OpenSceneMode.AdditiveWithoutLoading);

                if (firstLoadedScene.IsValid())
                {
                    EditorSceneManager.MoveSceneBefore(scene, firstLoadedScene);
                }
            }
        }
        if (!additive && activeScene.IsValid())
        {
            SceneManager.SetActiveScene(activeScene);
        }
    }
Пример #7
0
        protected void MoveSceneToTop(Scene scene)
        {
            Scene firstScene = EditorSceneManager.GetSceneAt(0);

            EditorSceneManager.MoveSceneBefore(scene, firstScene);
        }
Пример #8
0
    private static void OpenMultiscene(MultiScene obj, bool additive)
    {
        Scene activeScene = default(Scene);

        if (additive || EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
        {
            var   firstUnloadedScenes   = new List <string>();
            var   inFirstUnloadedScenes = true;
            Scene firstLoadedScene      = default(Scene);
            for (int i = 0; i < obj.sceneAssets.Count; i++)
            {
                var info = obj.sceneAssets[i];
                if (info.asset == null)
                {
                    continue;
                }
                var path          = AssetDatabase.GetAssetPath(info.asset.GetInstanceID());
                var mode          = OpenSceneMode.Single;
                var isActiveScene = info.asset == obj.activeScene;

                var exitedFirstUnloadedScenes = false;
                if (inFirstUnloadedScenes)
                {
                    if (!isActiveScene && !info.loadScene)
                    {
                        firstUnloadedScenes.Add(path);
                        continue;
                    }
                    else
                    {
                        inFirstUnloadedScenes     = false;
                        exitedFirstUnloadedScenes = true;
                    }
                }

                if ((!inFirstUnloadedScenes && !exitedFirstUnloadedScenes) || (additive && exitedFirstUnloadedScenes))
                {
                    if ((!additive && isActiveScene) || info.loadScene)
                    {
                        mode = OpenSceneMode.Additive;
                    }
                    else
                    {
                        mode = OpenSceneMode.AdditiveWithoutLoading;
                    }
                }

                var scene = EditorSceneManager.OpenScene(path, mode);

                if (isActiveScene)
                {
                    activeScene = scene;
                }
                if (exitedFirstUnloadedScenes)
                {
                    firstLoadedScene = scene;
                }
            }

            for (int i = 0; i < firstUnloadedScenes.Count; i++)
            {
                var path  = firstUnloadedScenes[i];
                var scene = EditorSceneManager.OpenScene(path, OpenSceneMode.AdditiveWithoutLoading);
                if (firstLoadedScene.IsValid())
                {
                    EditorSceneManager.MoveSceneBefore(scene, firstLoadedScene);
                }
            }
        }
        if (!additive && activeScene.IsValid())
        {
            EditorSceneManager.SetActiveScene(activeScene);
        }
    }
Пример #9
0
        private DragAndDropVisualMode DoDragScenes(GameObjectTreeViewItem parentItem, GameObjectTreeViewItem targetItem, bool perform, TreeViewDragging.DropPosition dropPos)
        {
            List <Scene> genericData = DragAndDrop.GetGenericData("SceneHeaderList") as List <Scene>;
            bool         flag1       = genericData != null;
            bool         flag2       = false;

            if (!flag1 && DragAndDrop.objectReferences.Length > 0)
            {
                int num = 0;
                foreach (UnityEngine.Object objectReference in DragAndDrop.objectReferences)
                {
                    if (objectReference is SceneAsset)
                    {
                        ++num;
                    }
                }
                flag2 = num == DragAndDrop.objectReferences.Length;
            }
            if (!flag1 && !flag2)
            {
                return(DragAndDropVisualMode.None);
            }
            if (perform)
            {
                List <Scene> sceneList = (List <Scene>)null;
                if (flag2)
                {
                    List <Scene> source = new List <Scene>();
                    foreach (UnityEngine.Object objectReference in DragAndDrop.objectReferences)
                    {
                        string assetPath   = AssetDatabase.GetAssetPath(objectReference);
                        Scene  sceneByPath = SceneManager.GetSceneByPath(assetPath);
                        if (SceneHierarchyWindow.IsSceneHeaderInHierarchyWindow(sceneByPath))
                        {
                            this.m_TreeView.Frame(sceneByPath.handle, true, true);
                        }
                        else
                        {
                            Scene scene = !Event.current.alt ? EditorSceneManager.OpenScene(assetPath, OpenSceneMode.Additive) : EditorSceneManager.OpenScene(assetPath, OpenSceneMode.AdditiveWithoutLoading);
                            if (SceneHierarchyWindow.IsSceneHeaderInHierarchyWindow(scene))
                            {
                                source.Add(scene);
                            }
                        }
                    }
                    if (targetItem != null)
                    {
                        sceneList = source;
                    }
                    if (SceneManager.sceneCount - source.Count == 1)
                    {
                        ((TreeViewDataSource)this.m_TreeView.data).SetExpanded(SceneManager.GetSceneAt(0).handle, true);
                    }
                    if (source.Count > 0)
                    {
                        Selection.instanceIDs = source.Select <Scene, int>((Func <Scene, int>)(x => x.handle)).ToArray <int>();
                        this.m_TreeView.Frame(source.Last <Scene>().handle, true, false);
                    }
                }
                else
                {
                    sceneList = genericData;
                }
                if (sceneList != null)
                {
                    if (targetItem != null)
                    {
                        Scene scene = targetItem.scene;
                        if (SceneHierarchyWindow.IsSceneHeaderInHierarchyWindow(scene))
                        {
                            if (!targetItem.isSceneHeader || dropPos == TreeViewDragging.DropPosition.Upon)
                            {
                                dropPos = TreeViewDragging.DropPosition.Below;
                            }
                            if (dropPos == TreeViewDragging.DropPosition.Above)
                            {
                                for (int index = 0; index < sceneList.Count; ++index)
                                {
                                    EditorSceneManager.MoveSceneBefore(sceneList[index], scene);
                                }
                            }
                            else if (dropPos == TreeViewDragging.DropPosition.Below)
                            {
                                for (int index = sceneList.Count - 1; index >= 0; --index)
                                {
                                    EditorSceneManager.MoveSceneAfter(sceneList[index], scene);
                                }
                            }
                        }
                    }
                    else
                    {
                        Scene sceneAt = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
                        for (int index = sceneList.Count - 1; index >= 0; --index)
                        {
                            EditorSceneManager.MoveSceneAfter(sceneList[index], sceneAt);
                        }
                    }
                }
            }
            return(DragAndDropVisualMode.Move);
        }
        /// <summary>
        /// Load a new scene group and unload the current one by group reference, editor only
        /// </summary>
        /// <param name="groupName">The target group</param>
        public static void OpenSceneBundle(SceneBundle newBundle)
        {
            //This value will be incremented each persisant scene loaded, will be checked later to get missing persistant scenes
            var persistantScenesCheckCount = 0;

            //Register dirty scenes
            var dirtyScenes = new List <Scene>();

            var saveFlag = false;

            SceneAsset[] persistantScenesAssets = SceneBundleEditor.GetBundleScenesAssets(CurrentSceneList.PersistantScenesBundle);
            bool         hasPersistantBundle    = persistantScenesAssets != null;

            for (int i = 0; i < EditorSceneManager.sceneCount; i++)
            {
                //Filter persistant scenes
                Scene scene = EditorSceneManager.GetSceneAt(i);

                //Check if opended scenes are dirty to call a save pannel
                if (scene.isDirty && !saveFlag)
                {
                    saveFlag = true;
                }

                //Check if iterated scene is persisant
                var persisantFlag = false;
                if (hasPersistantBundle)
                {
                    for (int j = 0; j < persistantScenesAssets.Length; j++)
                    {
                        if (scene.name == persistantScenesAssets[j].name)
                        {
                            persisantFlag = true;
                        }
                    }
                }

                if (!persisantFlag)
                {
                    dirtyScenes.Add(scene);
                }
                else
                {
                    //Doesn't add persistant scenes to dirty list
                    persistantScenesCheckCount++;                     //Count persistant scenes to check if each one is correctly loaded
                }
            }

            //Asks the user to save the scenes if a dirty one is detected
            if (saveFlag)
            {
                EditorSceneManager.SaveModifiedScenesIfUserWantsTo(dirtyScenes.ToArray());
            }

            //Check if all the scenes will be unload
            var fullLoad = EditorSceneManager.sceneCount <= dirtyScenes.Count;

            //Unload current scene except persistant ones, skip one scene if all scenes have to be reloaded
            for (int i = fullLoad ? 1 : 0; i < dirtyScenes.Count; i++)
            {
                EditorSceneManager.CloseScene(dirtyScenes[i], true);
            }


            //Load scenes in the bundle
            SceneAsset[] newBundleSceneAssets = SceneBundleEditor.GetBundleScenesAssets(newBundle);
            var          scenesPaths          = new string[newBundleSceneAssets.Length];

            for (int i = 0; i < newBundleSceneAssets.Length; i++)
            {
                scenesPaths[i] = AssetDatabase.GetAssetPath(newBundleSceneAssets[i]);
            }

            //Threat first scene
            var   firstSceneLoadMode = fullLoad ? OpenSceneMode.Single : OpenSceneMode.Additive;
            Scene active             = EditorSceneManager.OpenScene(scenesPaths[0], firstSceneLoadMode);

            for (int i = 1; i < scenesPaths.Length; i++)
            {
                EditorSceneManager.OpenScene(scenesPaths[i], OpenSceneMode.Additive);
            }

            //Check if persistant scenes are correctly loaded
            if (hasPersistantBundle && persistantScenesCheckCount != persistantScenesAssets.Length)
            {
                //Re-open persistant scenes
                for (int i = 0; i < persistantScenesAssets.Length; i++)
                {
                    var   scenePath = AssetDatabase.GetAssetPath(persistantScenesAssets[i]);
                    Scene scene     = EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Additive);
                    EditorSceneManager.MoveSceneBefore(scene, EditorSceneManager.GetSceneAt(i));
                }
            }

            //Active the first loaded scene of the bundle
            EditorSceneManager.SetActiveScene(active);
        }