Is there a quick way to reset the scene to the last saved state (in the editor)? I know it is possible to Undo changes one by one, but is there a way to quickly undo all changes made since the last save?
I go a bit bored this morning and decided to try a custom editor script with a hotkey to achieve this as mentioned in the comments. Adding here in case the author or anyone else finds it useful.
Currently bound to Ctrl+Shift+R but that can be changed on the MenuItem attribute as people see fit.
It works by storing the path of the current scene and simply re-opening it.
[MenuItem("Test/SceneRefresh %#R")]
public static void ReloadCurrentScene()
{
// Grab current scene path.
string currentScenePath = EditorSceneManager.GetActiveScene().path;
// Re-open the scene (removes unsaved changes)
EditorSceneManager.OpenScene(currentScenePath);
}
NOTE: This was written in Unity 5.5, the scene management code is probably different in some older versions. Also after a quick test if you have multiple scenes open, all other scenes are closed and only the active scene is re-opened. I may look for a way to re-work this script to leave those scenes open when refreshing the active scene but I need to go buy food first, coders gotta eat.
Edit:
So I was halfway out the door when curiosity got the better of me, “Surely the new scene tools in unity support this by default…they must do!”, back to my desk I trot, and sure enough, I discover that this is (in any version of the editor using the newer scene management) completely supported by default. The context menu of any loaded scene contains a “Discard Changes” menu item.
So what we have learned today? I should never rush out a script after breakfast without looking twice, and that I really should leave before the shops close or I’m having toast for dinner.