So, I have been working on a unity project for some time, I made nice scene, but today, unity crashed and my scene was lost. I didn’t had any backups because the last thing that would come into my mind is loosing scene like this. Anyway, does anybody know the way how to get it back? I have menaged to restore some unity temp files, that were lost, but looks like they have nothing to do with the scene. Also, I have my game with this scene built, so maybe there is way to restore scene via built game?
Anyway, if there is no way to restore this, I am happy that it happen now, because it could have happen in about a year, when I may had finished my game, so only thing that will be left to me then is to kill myself.
This is why I have made saving the scene a reflex. I basically hit Ctrl+S after every change to the scene.
Sometimes Unity WILL crash, so making saving a habit helps minimize the damage. Because if it crashes before the first save, you will loose the entire scene.
And as an added precaution, use 7Z to make backups of your project folder when going to bed.
Answer by Eric5h5:
Provided you do not load Unity straight away after the crash, you can recover your scene.
Don’t restart Unity until you recover your temporary file.
We did the same thing @FairGamesProductions. Saving both the project and the scene repeatedly, our scene was obliterated immediately when restarting Unity after it stopped responding.
All the best luck!!!
This just happened to me, after a few deep breaths, I checked the recycle bin.
do your self a favour and add this to every project you start, it has helped me countless of times where i would have lost allot of stuff:
Create a c# file named “AutoSave”
/// <summary>
/// AutoSave.cs, editor helper script. Saves the scene ans modified assets when you hit Play in the Unity Editor, so if Unity should
/// crash, or similar, you don't lose any scene or assets you haddn't saved before hitting Play.
/// </summary>
///
/// <remarks>
/// Created (date - name): 10th March 2015 - Gavin Thornton
/// Modified (date - name): 8th Jan 2017 - Gavin Thornton - #if UNITY_EDITOR moved to fix cloud build
/// Modified (date - name): 30th March 2017 - Gavin Thornton - line "EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene());" changed to multi scene version "EditorSceneManager.SaveOpenScenes();"
/// </remarks>
#if UNITY_EDITOR
using System;
using System.IO;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
[InitializeOnLoad]
#if false // Change this to "#if true" if you want to disble the script temporarily (without having to delete it)
public class OnUnityLoad
{
static OnUnityLoad()
{
EditorApplication.playmodeStateChanged = () =>
{
if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
Debug.Log("*** WARNING:Auto-Saving DISABLED ***" + EditorApplication.currentScene);
};
}
}
#else
public class OnUnityLoad
{
static OnUnityLoad()
{
EditorApplication.playmodeStateChanged = () =>
{
if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
{
// Unity 5+
Debug.Log("Auto-saving scene and any asset edits" + EditorSceneManager.GetActiveScene());
EditorSceneManager.SaveOpenScenes();
AssetDatabase.SaveAssets();
// Old code for Unity 4.6 and below users below -------------------
//Debug.Log("Auto-saving scene " + EditorApplication.currentScene);
//EditorApplication.SaveScene();
//EditorApplication.SaveAssets();
}
};
}
}
#endif
#endif // #if UNITY_EDITOR
I had the same problem two times, a scene was lost with all the work in it. Very bad.The file size of the scene was 0 kb. Deleted. The other scenes were compete. No way to get it back because the file is empty.
Now I dont just save it but duplicate it by the time and I have a really saved copy. In a crash the open screne sometime is lost, saved or not, totally with all elder savings.
The problem occoures while using one project on two machines with the same file on a mobile hard drive. Now I always make a own copy before using it on the other one. This seems to work. But quiet expensive in diskspace and time.