/// <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); } }
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> /// 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); }