Skip to content

Commit

Permalink
fix: exception when scene is unloaded
Browse files Browse the repository at this point in the history
Closes: #436
  • Loading branch information
bdunderscore committed Oct 5, 2024
1 parent a606812 commit 68ec75f
Showing 1 changed file with 2 additions and 2 deletions.
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 68ec75f

Please sign in to comment.