Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: exception when scene is unloaded #438

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading