Where is getPreviewSceneAt and getAllPreviewScenes function?

We have function EditorSceneManager.NewPreviewScene that cannot do anything. And if we don’t cache it ourselves. It will stay in the editor. It will leave it trace only in EditorSceneManager.previewSceneCount but we have no way to interact with it after that

Even the source has only internal OpenPreviewScene (why it was internal though? I think it should be exposed to) I think unity should have put all created PreviewScene in some collection anyway. Please expose that so we could find and close it when it don’ needed

1 Like

Bump

The method returns the created scene.

I think the way it’s meant to be used is when you’re inheriting from Stage, and using things like Unity - Scripting API: SceneManagement.StageUtility.GoToStage

I know that NewPreviewScene will return the created scene. What I mean is, if we lose track of it, it was not garbage collected and it will be leaked forever

Meanwhile the existence previewSceneCount indicate existence of the list that contain created previewscenes. So making the list ourselves and save it from NewPreviewScene is redundant

Could you please elaborate how to using stage to solve this problem?

Right, sorry, I was a bit too tired when I answered that post.

Yeah, it totally makes sense that all the existing preview scenes should be available in some manner. I guess the idea is that other systems ought to own preview scenes, and that killing preview scenes that other windows might own could be bad, but that’s just something that should be solved by the user not being an idiot.

1 Like