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
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.