diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d58692..f1cb8e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,18 @@ # Change Log All notable changes to this project will be documented in this file. +## [2.0.2] - 2025-12-15 + +### Fixed +- Fixed issue, where scenes could be valid, but not loaded and still crash Unity Editor when accessing path + + ## [2.0.1] - 2025-12-15 ### Fixed - Fixed issue, where fetching scenes would not initially check if the scene was valid before accessing the path - ## [2.0.0] - 2025-12-06 - Navigation tools upgraded to use the new `MainToolbarElement` API diff --git a/Editor/Toolbar/MainToolbarElements/MainToolbarScenePickerElement.cs b/Editor/Toolbar/MainToolbarElements/MainToolbarScenePickerElement.cs index 33d3ddf..f824329 100644 --- a/Editor/Toolbar/MainToolbarElements/MainToolbarScenePickerElement.cs +++ b/Editor/Toolbar/MainToolbarElements/MainToolbarScenePickerElement.cs @@ -38,7 +38,11 @@ namespace Module.NavigationTool.Editor.Toolbar for (var i = 0; i < SceneList.labels.Length; i++) { var sceneIndex = i; - menu.AddItem(SceneList.labels[i], SceneList.selected.Contains(i), () => SelectScene(sceneIndex)); + menu.AddItem(SceneList.labels[i], SceneList.selected.Contains(i), () => + { + if (!Application.isPlaying) + SelectScene(sceneIndex); + }); } menu.DropDown(rect); diff --git a/Editor/Toolbar/Tools/ScenePickerObjects/ScenePickerList.cs b/Editor/Toolbar/Tools/ScenePickerObjects/ScenePickerList.cs index bac13ec..8a47095 100644 --- a/Editor/Toolbar/Tools/ScenePickerObjects/ScenePickerList.cs +++ b/Editor/Toolbar/Tools/ScenePickerObjects/ScenePickerList.cs @@ -2,6 +2,7 @@ using System.IO; using System.Linq; using UnityEditor; +using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.SceneManagement; @@ -248,7 +249,9 @@ namespace Module.NavigationTool.Editor.Toolbar { Scene scene = SceneManager.GetSceneAt(i); - if (!scene.IsValid() || string.IsNullOrEmpty(scene.path)) + if (!scene.IsValid() || !scene.isLoaded) + continue; + if (string.IsNullOrEmpty(scene.path)) continue; int index = IndexOfPath(scenes, scene.path, false); diff --git a/package.json b/package.json index 1e14e95..62aa855 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.module.navigationtool", - "version": "2.0.1", + "version": "2.0.2", "displayName": "Module.NavigationTool", "description": "Support for navigation tools, like favorites, history and toolbars", "unity": "2019.2",