예제 #1
0
        private void OnGUI()
        {
            GUILayout.BeginVertical();
            {
                GUILayout.Label("Loaded scenes");

                if (!Application.isPlaying)
                {
                    SceneListScrollViewPosition = GUILayout.BeginScrollView(SceneListScrollViewPosition);
                    {
                        SceneSetup[] sceneSetups = EditorSceneManager.GetSceneManagerSetup();
                        for (int i = 0; i < sceneSetups.Length; ++i)
                        {
                            GUILayout.BeginHorizontal();
                            {
                                GUILayout.Space(20);
                                GUILayout.Label(sceneSetups[i].path);
                            }
                            GUILayout.EndHorizontal();
                        }
                    }
                    GUILayout.EndScrollView();
                }
                else
                {
                    GUILayout.Label("Not available during Play");
                }
            }
            GUILayout.EndVertical();

            GUILayout.Space(5);

            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Save scenes"))
                {
                    PSSceneManagerUtility.SaveSceneAsset();
                    Status = "Scenes saved !";
                }

                if (GUILayout.Button("Restore scenes"))
                {
                    if (PSSceneManagerUtility.LoadSceneAsset())
                    {
                        Status = "Load success ! ";
                    }
                    else
                    {
                        Status = "Cannot load asset : " + PSSceneManagerUtility.DetectSaveDatas();
                    }
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(5);

            GUILayout.Label(Status);
        }
예제 #2
0
        void OnSceneChanged()
        {
            // Get EditorWindow if present in editor to display error message
            PSSceneManagerEditorWindow window = PSSceneManagerEditorWindow.Instance;
            string errorMessage = "";

            if (!PSSceneManagerUtility.LoadSceneAsset())
            {
                errorMessage = "No data to load";
            }

            if (window != null)
            {
                window.Status = errorMessage;
            }
        }