diff --git a/Editor/PreviewSystem/Rendering/NDMFPreviewSceneManager.cs b/Editor/PreviewSystem/Rendering/NDMFPreviewSceneManager.cs index a2be569..ef4efd1 100644 --- a/Editor/PreviewSystem/Rendering/NDMFPreviewSceneManager.cs +++ b/Editor/PreviewSystem/Rendering/NDMFPreviewSceneManager.cs @@ -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; @@ -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();