Skip to content

Commit

Permalink
fix: exception when scene is unloaded (#438)
Browse files Browse the repository at this point in the history
Closes: #436
  • Loading branch information
bdunderscore authored Oct 5, 2024
1 parent a606812 commit 744a413
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Fixed
- [#435] Fixed an issue where `File -> Save As` could break due to the internal preview scene becoming selected
- [#438] Fixed an issue where exceptions would be thrown when scenes are unloaded

### Changed

Expand All @@ -23,7 +23,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.5.3] - [2024-10-03]

### Fixed

- [#435] Fixed an issue where `File -> Save As` could break due to the internal preview scene becoming selected

## [1.5.2] - [2024-10-02]
Expand Down
4 changes: 2 additions & 2 deletions Editor/PreviewSystem/Rendering/NDMFPreviewSceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static void Init()
for (var i = 0; i < sceneCount; i++)
{
var scene = SceneManager.GetSceneAt(i);
if (scene == _previewScene) continue;
if (scene == _previewScene || !scene.isLoaded || !scene.IsValid()) continue;
SceneManager.SetActiveScene(scene);
found = true;
Expand All @@ -71,7 +71,7 @@ private static void Init()
if (!found)
{
// Unload the preview scene if it's the only one left
// Unload the preview scene if it's the only valid/loaded scene left
EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
ResetPreviewScene();
Expand Down

0 comments on commit 744a413

Please sign in to comment.