Ejemplo n.º 1
0
        /// <summary>
        /// Called when loading a scene while on the baking process
        /// </summary>
        /// <param name="scene">Scene that was loaded</param>
        /// <param name="mode"> Mode in which the scene was loaded </param>
        void OnBakeLevelOpened(Scene scene, OpenSceneMode mode)
        {
            //Update progress
            EditorUtility.DisplayProgressBar("Baking resources...", "Searching available resources through BuildScenes...", ((float)CurrentBakeScene) / ((float)BuildScenes.Length));

            //Resources will most likely be set as inactive, so we need to obtain them using the scene manager
            GameObject[] Roots = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects();

            foreach (GameObject go in Roots)
            {
                List <Recurso> Recursos = new List <Recurso>();
                go.GetComponentsInChildren <Recurso>(true, Recursos);

                //Need to add to the baked list
                foreach (Recurso r in Recursos)
                {
                    IndexMap.Add(r.Codigo, scene.path);
                }
            }

            //Finished baking of this scene, request the next one
            if (BuildScenes.Length > ++CurrentBakeScene)
            {
                UnityEditor.SceneManagement.EditorSceneManager.OpenScene(BuildScenes[CurrentBakeScene].path);
            }
            else
            {
                EndBake();
            }
        }
Ejemplo n.º 2
0
        void OnSceneOpened(Scene scene, OpenSceneMode mode)
        {
            if (scene == null || recentScenes == null)
            {
                return;
            }

            SceneInfo sceneInfo = recentScenes.Find(x => x.scenePath == scene.path);

            if (sceneInfo != null)
            {
                recentScenes.Remove(sceneInfo);
            }
            else if (recentScenes.Count == RECENT_SCENES_CAPACITY)
            {
                recentScenes.RemoveAt(recentScenes.Count - 1);
            }

            recentScenes.Insert(0, new SceneInfo()
            {
                scenePath = scene.path,
                name      = scene.name
            });

            SaveData();
        }
 private void OnSceneOpened(Scene scene, OpenSceneMode mode)
 {
     if (mode == OpenSceneMode.Single)
     {
         UnselectPalette();
     }
 }
Ejemplo n.º 4
0
        public static Scene OpenScene(string scenePath, [DefaultValue("OpenSceneMode.Single")] OpenSceneMode mode)
        {
            Scene scene;

            INTERNAL_CALL_OpenScene(scenePath, mode, out scene);
            return(scene);
        }
Ejemplo n.º 5
0
        public static Scene OpenScene(string scenePath, [DefaultValue("OpenSceneMode.Single")] OpenSceneMode mode)
        {
            Scene result;

            EditorSceneManager.INTERNAL_CALL_OpenScene(scenePath, mode, out result);
            return(result);
        }
 private static void Internal_SceneWasOpened(Scene scene, OpenSceneMode mode)
 {
     if (sceneWasOpened != null)
     {
         sceneWasOpened(scene, mode);
     }
 }
 private static void EditorSceneEventManager_OnSceneOpened(Scene scene, OpenSceneMode mode)
 {
     if (OpenSceneMode.Single != mode)
     {
         return;
     }
     ResetPluginAndTasks();
 }
Ejemplo n.º 8
0
 /// <summary>
 /// シーンファイルを開いた時に参照を割り当てます
 /// </summary>
 private static void OnSceneOpened(Scene scene, OpenSceneMode mode)
 {
     if (EditorApplication.isPlaying)
     {
         return;
     }
     InjectAll();
 }
Ejemplo n.º 9
0
 private static void EditorSceneManagerOnSceneOpening(string path, OpenSceneMode mode)
 {
     RevertIsolationCurrentStage();
     if (mode == OpenSceneMode.Single)
     {
         SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes();
     }
 }
Ejemplo n.º 10
0
 static void OnSceneOpened(Scene scene, OpenSceneMode mode)
 {
     if (scene.name == "Game")
     {
         return;
     }
     _loadedLevelScene.Add(scene);
 }
Ejemplo n.º 11
0
        public static Scene OpenScene(string scenePath)
        {
            OpenSceneMode mode = OpenSceneMode.Single;
            Scene         result;

            EditorSceneManager.INTERNAL_CALL_OpenScene(scenePath, mode, out result);
            return(result);
        }
Ejemplo n.º 12
0
 private static void OnSceneOpened(Scene scene, OpenSceneMode mode)
 {
     RefreshReferences();
     if (mode == OpenSceneMode.Single)
     {
         ShowTimeline();
     }
 }
Ejemplo n.º 13
0
        public static Scene OpenScene(string scenePath)
        {
            Scene         scene;
            OpenSceneMode single = OpenSceneMode.Single;

            INTERNAL_CALL_OpenScene(scenePath, single, out scene);
            return(scene);
        }
 void OnSceneOpened(Scene scene, OpenSceneMode open)
 {
     if (m_selectedMode != VISUALIZERMODE.None)
     {
         m_selectedMode          = VISUALIZERMODE.None;
         m_VisualizationMaterial = null;
     }
 }
 private void EditorSceneManager_sceneOpened(Scene scene, OpenSceneMode mode)
 {
     // Scene change
     if (scene == SceneManager.GetActiveScene())
     {
         SetupAll();
     }
 }
Ejemplo n.º 16
0
 private static void SceneOpened(UnityEngine.SceneManagement.Scene scene, OpenSceneMode mode)
 {
     if (ResetOnSceneChange)
     {
         lastTimestamp = GetTimestamp();
     }
     SceneName = EditorSceneManager.GetActiveScene().name;
     UpdateActivity();
 }
 protected virtual void SettingsTabGUI()
 {
     this.newSceneSetup   = (NewSceneSetup)EditorGUILayout.EnumPopup("New Scene Setup", this.newSceneSetup);
     this.newSceneMode    = (NewSceneMode)EditorGUILayout.EnumPopup("New Scene Mode", this.newSceneMode);
     this.openSceneMode   = (OpenSceneMode)EditorGUILayout.EnumPopup("Open Scene Mode", this.openSceneMode);
     this.showPath        = EditorGUILayout.Toggle("Show Path", this.showPath);
     this.showAddToBuild  = EditorGUILayout.Toggle("Show Add To Build", this.showAddToBuild);
     this.askBeforeDelete = EditorGUILayout.Toggle("Ask Before Delete", this.askBeforeDelete);
 }
Ejemplo n.º 18
0
    private IEnumerator OpenSceneAsync(string scene, OpenSceneMode sceneMode)
    {
        yield return(new WaitForEndOfFrame());

        string _fileName = Path.GetFileName(scene);

        OpenScene(scene, sceneMode);
        yield return(new WaitForEndOfFrame());
    }
Ejemplo n.º 19
0
    // Play mode change callback handles the scene load/reload.
    private static void OnPlayModeChanged(PlayModeStateChange state)
    {
        if (!LoadMasterOnPlay)
        {
            return;
        }

        if (!EditorApplication.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode)
        {
            // User pressed play -- autoload master scene.
            string[] tempArray = new string[SceneManager.sceneCount];
            for (int i = 0; i < SceneManager.sceneCount; i++)
            {
                tempArray[i] = SceneManager.GetSceneAt(i).path;
            }
            PreviousScenes = tempArray;

            //PreviousScene = EditorSceneManager.GetActiveScene().path;
            if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
            {
                try
                {
                    EditorSceneManager.OpenScene(MasterScene);
                }
                catch
                {
                    Debug.LogError(string.Format("error: scene not found: {0}", MasterScene));
                    EditorApplication.isPlaying = false;
                }
            }
            else
            {
                // User cancelled the save operation -- cancel play as well.
                EditorApplication.isPlaying = false;
            }
        }

        // isPlaying check required because cannot OpenScene while playing
        if (!EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode)
        {
            // User pressed stop -- reload previous scene.
            var prevScenes = PreviousScenes;
            for (int i = 0; i < prevScenes.Length; i++)
            {
                string path = prevScenes[i];

                OpenSceneMode mode = (i == 0) ? OpenSceneMode.Single : OpenSceneMode.Additive;

                try {
                    EditorSceneManager.OpenScene(path, mode);
                }
                catch {
                    Debug.LogError(string.Format("error: scene not found: {0}", path));
                }
            }
        }
    }
Ejemplo n.º 20
0
 /// <summary>
 /// Handle <see cref="ToolbarButton"/>s addition for provided scene.
 /// </summary>
 /// <param name="scene"></param>
 /// <param name="mode"></param>
 private static void SceneOpenedCallback(Scene scene, OpenSceneMode mode)
 {
     ToolboxEditorToolbar.OnToolbarGui -= OnToolbarGui;
     if (scene.name != mySampleSceneName)
     {
         return;
     }
     ToolboxEditorToolbar.OnToolbarGui += OnToolbarGui;
 }
        private static void OnSceneOpened(Scene scene, OpenSceneMode mode)
        {
            if (!_skipSceneOpen)
            {
                List <UdonBehaviour> udonBehaviours = GetAllUdonBehaviours();

                RunAllUpdates(udonBehaviours);
            }
        }
        private void OnEnable()
        {
            scenesSource  = (ScenesSource)EditorPrefs.GetInt("SceneSwitcher.scenesSource", (int)ScenesSource.Assets);
            openSceneMode = (OpenSceneMode)EditorPrefs.GetInt("SceneSwitcher.openSceneMode", (int)OpenSceneMode.Single);

            ResetData();

            LoadScenesData();
            SaveScenesFromAssets();
        }
Ejemplo n.º 23
0
 static void OnSceneLoading(string path, OpenSceneMode mode)
 {
     Debug.Log("OnSceneLoading " + path + " " + mode);
     if (!FileModifiedChecker.CanEditFile(path))
     {
         string message = "ERROR can't edit file " + path + " since it's currently not editable and might be locked. Further edits might be lost";
         Debug.LogError(message);
         ShowPopup.Init(message);
     }
 }
Ejemplo n.º 24
0
    private static void OnSceneOpened(Scene scene, OpenSceneMode mode)
    {
        if (!shouldPlay)
        {
            return;
        }
        shouldPlay = false;

        EditorApplication.EnterPlaymode();
    }
Ejemplo n.º 25
0
        private static void EditorUpdateManager_OnSceneOpened(Scene scene, OpenSceneMode mode)
        {
            if (OpenSceneMode.Single != mode)
            {
                return;
            }


            ResetImageLoading();
        }
 void SceneOpened(Scene scene, OpenSceneMode mode)
 {
     {
         // @TODO: This is a temporary workaround until ObjectChangeEventStream handles this
         // When a scene is re-loaded, we need to re-convert it. This happens for example when the changes in a scene
         // are discarded.
         GetLiveLink(scene)?.RequestCleanConversion();
     }
     EditorUpdateUtility.EditModeQueuePlayerLoopUpdate();
 }
Ejemplo n.º 27
0
    private static void OnOpened(Scene scene, OpenSceneMode mode)
    {
        var god = EditorWindowParameter.instance;

        if (god.projectWasLoaded)
        {
            Debug.Log("OnOpened: " + scene.name + " (" + mode + ") excute WSPanel.SetHierarchy()");
            WSPanel.SetHierarchy();
        }
    }
Ejemplo n.º 28
0
        private static void OnOpened(Scene scene, OpenSceneMode mode)
        {
            var targetSceneName = "SRDisplaySampleHome";

            if (scene.name != targetSceneName)
            {
                return;
            }

            var splittedPath = scene.path.Split('/').ToList();

            splittedPath.RemoveRange(splittedPath.Count - 3, 3);
            var basePath = string.Join("/", splittedPath);

            var addScenes = new List <string>()
            {
            };
            var currentSetScenePaths = EditorBuildSettings.scenes.Select(s => s.path).ToArray();

            foreach (var sceneName in _scenePaths)
            {
                if (Array.IndexOf(currentSetScenePaths, basePath + "/" + sceneName) < 0)
                {
                    addScenes.Add(sceneName);
                }
            }

            if (addScenes.Count == 0)
            {
                return;
            }

            var messageList = new List <string>()
            {
                string.Format("Add the following scenes for this {0} Scene: ", targetSceneName), string.Format("(If you cancel this dialog, {0} does not work)\n", targetSceneName),
            };

            messageList.AddRange(addScenes.Select(s => "  - " + s));

            var message = string.Join("\n", messageList);

            if (EditorUtility.DisplayDialog("Confirm", message, "OK"))
            {
                var currentNum = EditorBuildSettings.scenes.Length;
                var addNum     = addScenes.Count;
                var result     = new EditorBuildSettingsScene[currentNum + addNum];
                Array.Copy(EditorBuildSettings.scenes, result, currentNum);
                for (var i = 0; i < addNum; i++)
                {
                    result[currentNum + i] = new EditorBuildSettingsScene(basePath + "/" + addScenes[i], true);
                }
                Array.Sort(result, (a, b) => string.Compare(a.path, b.path));
                EditorBuildSettings.scenes = result;
            }
        }
Ejemplo n.º 29
0
    void OnOpened(Scene scene, OpenSceneMode mode)
    {
        if (null != datas.Find(d => d.path == scene.path))
        {
            return;
        }
        SceneHistoryData data = new SceneHistoryData(scene.name, scene.path, mode);

        datas.Insert(0, data);
        Repaint();
    }
Ejemplo n.º 30
0
        static void OnSceneOpened(Scene scene, OpenSceneMode mode)
        {
            if (Application.isPlaying)
            {
                return;
            }

            Log("Opened editor scene " + scene.path);
            scenesLoadPending = true;
            Log("PENDING Opened editor scene " + scene.path + " " + scenesLoadPending);
        }
Ejemplo n.º 31
0
 private static void Internal_SceneWasOpened(Scene scene, OpenSceneMode mode)
 {
     if (sceneWasOpened != null)
     {
         sceneWasOpened(scene, mode);
     }
 }
 private static extern void INTERNAL_CALL_OpenScene(string scenePath, OpenSceneMode mode, out Scene value);
Ejemplo n.º 33
0
        void OpenNextScene(OpenSceneMode openMode)
        {
            var scenePath = TryGetScenePath(_decoratedSceneProperty.stringValue);

            if (scenePath == null)
            {
                EditorUtility.DisplayDialog("Error",
                    "Could not find scene with name '{0}'.  Is it added to your build settings?".Fmt(_decoratedSceneProperty.stringValue), "Ok");
            }
            else
            {
                if (openMode == OpenSceneMode.Single)
                {
                    if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
                    {
                        return;
                    }
                }

                var scene = EditorSceneManager.OpenScene(scenePath, openMode);
                SelectContext(scene);
            }
        }