Determine if editor is in dirty state (current scene needs to be saved)


I couldn’t find any info about this…

I’m building an editor window who can change scene when you click on a button. I’d like to know if the current scene is dirty (something changed and needs to be saved) or not, prior to opening the new one. Is there any way to do it?


Found a sort of solution. Calling EditorApplication.SaveCurrentSceneIfUserWantsTo() will open a save popup only if the current scene is dirty.

Since Unity 2017.3, the answer is SceneManager.GetActiveScene().isDirty

This is old, but it still hits on Google searches so I thought I should answer it.

This can now be checked via EditorApplication.isSceneDirty