From 70956133672b7bed5d0b95ceaa8434afc4218498 Mon Sep 17 00:00:00 2001 From: Edvinas Date: Thu, 26 Sep 2024 16:57:24 +0300 Subject: [PATCH] Fix cancel button being ignored --- Packages/com.chark.scriptable-scenes/CHANGELOG.md | 4 ++++ .../Editor/Utilities/ScriptableSceneEditorUtilities.cs | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Packages/com.chark.scriptable-scenes/CHANGELOG.md b/Packages/com.chark.scriptable-scenes/CHANGELOG.md index b78040c..4f957ae 100644 --- a/Packages/com.chark.scriptable-scenes/CHANGELOG.md +++ b/Packages/com.chark.scriptable-scenes/CHANGELOG.md @@ -11,6 +11,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Menu item order to use `150` instead of `-1000`. This way `CHARK` won't dominate existing entries. +### Fixed + +- Cancel button being ignored when switching scenes via the "Open" button. + ## [v0.0.10](https://github.com/chark/scriptable-scenes/compare/v0.0.9...v0.0.10) - 2023-10-04 ### Changed diff --git a/Packages/com.chark.scriptable-scenes/Editor/Utilities/ScriptableSceneEditorUtilities.cs b/Packages/com.chark.scriptable-scenes/Editor/Utilities/ScriptableSceneEditorUtilities.cs index ab06540..fdda2ab 100644 --- a/Packages/com.chark.scriptable-scenes/Editor/Utilities/ScriptableSceneEditorUtilities.cs +++ b/Packages/com.chark.scriptable-scenes/Editor/Utilities/ScriptableSceneEditorUtilities.cs @@ -123,6 +123,12 @@ internal static void Open(this ScriptableSceneCollection collection) var scriptableScenes = collection.Scenes.ToList(); if (scriptableScenes.Count == 0) + { + Debug.LogWarning($"Collection {collection.Name} does not contain any scenes", collection); + return; + } + + if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo() == false) { return; } @@ -132,8 +138,6 @@ internal static void Open(this ScriptableSceneCollection collection) var scriptableScene = scriptableScenes[index]; var scenePath = scriptableScene.ScenePath; - EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); - Scene scene; if (index == 0) {