/// <summary>
        /// Display the current scene list field
        /// </summary>
        private void DisplayCurrentSceneList()
        {
            EditorGUI.BeginChangeCheck();
            SceneBundleList list = EditorGUILayout.ObjectField("Current Bundle List", EnhancedSceneManager.GetCurrentSceneList(), typeof(SceneBundleList), false) as SceneBundleList;

            if (EditorGUI.EndChangeCheck() && list != null)
            {
                EditorEnhancedSceneManager.SetSceneBundleListHasCurrent(list);
            }
        }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            if (updateBuildSettingsFlag)
            {
                updateBuildSettingsFlag = false;
            }

            EditorGUILayout.PropertyField(persistantSceneBundle);

            GUILayout.Space(8f);
            EditorGUI.BeginChangeCheck();
            sceneBundleList.DoLayoutList();
            if (EditorGUI.EndChangeCheck())
            {
                updateBuildSettingsFlag = true;
            }

            EditorGUILayout.Separator();

            if (hasSimilarReferences)
            {
                EditorGUILayout.HelpBox("Similar references! There will be automatically removed once you stop editing this object", MessageType.Warning);
            }

            if (hasNullReferences)
            {
                EditorGUILayout.HelpBox("Null references! There will be automatically removed once you stop editing this object", MessageType.Error);
            }

            if (EnhancedSceneManager.GetCurrentSceneList() == target)
            {
                EditorGUILayout.HelpBox("Current Scene Bundle List", MessageType.None);
            }
            else
            {
                if (GUILayout.Button("Set as current"))
                {
                    EditorEnhancedSceneManager.SetSceneBundleListHasCurrent(target as SceneBundleList);
                }
            }

            serializedObject.ApplyModifiedProperties();
            if (updateBuildSettingsFlag)
            {
                UpdateBuildSettings();
            }
        }
        /// <summary>
        /// Display the button of a Scene Bundle
        /// </summary>
        private void DisplaySceneBundleButton(SceneBundle bundle)
        {
            GUIContent content = new GUIContent(bundle.name, bundle.Description);

            if (GUILayout.Button(content, GUILayout.Height(30f)))
            {
                EditorEnhancedSceneManager.OpenSceneBundle(bundle);
            }

            if (GUILayout.Button("A", GUILayout.Width(20f), GUILayout.Height(30f)))
            {
                Selection.activeObject = bundle;
                EditorGUIUtility.PingObject(bundle);
            }
        }
        /// <summary>
        /// Creates a new Scene Bundle List in the target bundle
        /// </summary>
        private void CreateSceneBundleList()
        {
            string path = EditorUtility.SaveFilePanelInProject("Create new Scene Bundle List", "NewSceneBundleList.asset", "asset", "Please enter a name to the Scene Bundle list");

            if (path.Length <= 0)
            {
                return;
            }

            SceneBundleList newSceneBundleList = SceneBundleList.CreateInstance <SceneBundleList>();

            AssetDatabase.CreateAsset(newSceneBundleList, path);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            EditorEnhancedSceneManager.SetSceneBundleListHasCurrent(newSceneBundleList);
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            sceneAssetsList.DoLayoutList();

            if (hasSimialarReference)
            {
                EditorGUILayout.HelpBox("Similar Scene Asset reference, remove ot or it will deleted once you finished editing this object", MessageType.Warning);
            }

            if (hasNullReference)
            {
                EditorGUILayout.HelpBox("Missing scene asset, cannot generate scene labels correcty. Ensure that each scene asset references aren't null in the Scene Bundle", MessageType.Error);
            }
            EditorGUILayout.Separator();

            if (sceneLabels.arraySize > 0)
            {
                DisplayGeneratedLabelsPannel();
            }

            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(description);

            GUILayout.Space(20f);
            EditorUtils.BeginColorField(EditorUtils.validColor);
            if (GUILayout.Button("Open"))
            {
                EditorEnhancedSceneManager.OpenSceneBundle(target as SceneBundle);
            }
            EditorUtils.EndColorField();

            if (GUILayout.Button("Add Opened Scenes"))
            {
                AddOpenedScenes();
            }
            serializedObject.ApplyModifiedProperties();
        }