From 305aa13317f2a00ff60867a0cd391cf132c316cd Mon Sep 17 00:00:00 2001 From: Anders Ejlersen Date: Thu, 16 Mar 2023 17:55:56 +0100 Subject: [PATCH] 1.8.3: Create new scene will now give the option to create it as single or additive --- CHANGELOG.md | 6 ++++++ Editor/Toolbar/Tools/ToolScenePicker.cs | 22 ++++++++++++++++------ package.json | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59d25e7..87af46b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to this project will be documented in this file. +## [1.8.3] - 2023-03-16 + +### Changed +- Create new scene will now give the option to create it as single or additive + + ## [1.8.2] - 2023-03-14 ### Added diff --git a/Editor/Toolbar/Tools/ToolScenePicker.cs b/Editor/Toolbar/Tools/ToolScenePicker.cs index e1ed296..49a84da 100644 --- a/Editor/Toolbar/Tools/ToolScenePicker.cs +++ b/Editor/Toolbar/Tools/ToolScenePicker.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; using System.Runtime.CompilerServices; using System.Text; @@ -183,13 +184,22 @@ namespace Module.NavigationTool.Editor.Toolbar { if (GUI.Button(rect, styles.iconPlusSmall, styles.button)) { - if (!EditorUtility.DisplayDialog("Create new scene", "Are you sure that you want to create a new scene?", "Yes", "No")) - return; + try + { + int selection = EditorUtility.DisplayDialogComplex("Create new scene", "How do you want to add the scene?", "Single", "Additive", "Cancel"); + + if (selection == 2) + return; - Scene scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive); + Scene scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, selection == 0 ? NewSceneMode.Single : NewSceneMode.Additive); - if (EditorUtility.DisplayDialog("Create new scene", "Save scene to disk?", "Yes", "No")) - EditorSceneManager.SaveScene(scene); + if (EditorUtility.DisplayDialog("Create new scene", "Save scene to disk?", "Yes", "No")) + EditorSceneManager.SaveScene(scene); + } + catch (Exception e) + { + EditorUtility.DisplayDialog("Failed to add scene", e.Message, "Ok"); + } } GUI.Label(rect, LABEL_SCENE_CREATE, styles.labelCenter); diff --git a/package.json b/package.json index 06adf6b..70a3408 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.module.navigationtool", - "version": "1.8.2", + "version": "1.8.3", "displayName": "Module.NavigationTool", "description": "Support for navigation tools, like favorites, history and toolbars", "unity": "2019.2",