So I got on my computer today to work on my game. I loaded up the scene. Everything in the hierarchy is GONE. What happened, and can I get it back?
EDIT:
How do I load a backup file?
So I got on my computer today to work on my game. I loaded up the scene. Everything in the hierarchy is GONE. What happened, and can I get it back?
EDIT:
How do I load a backup file?
It’s absolutely no substitute for keeping backups (I run mine automatically at noon every day, backed to a RAID1 NAS, the drives of which I replace annually, and even with that I get uneasy)… but here’s my auto-save script:
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
class AutoSave
{
static AutoSave()
{
EditorApplication.update += Save;
}
static double nextSave = 0.0;
static double interval = 10.0;
static void Save()
{
if (EditorApplication.timeSinceStartup >= nextSave && !EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying && EditorApplication.currentScene != "") {
nextSave = EditorApplication.timeSinceStartup + interval;
if (System.IO.File.Exists(EditorApplication.currentScene+"-2"))
FileUtil.ReplaceFile(EditorApplication.currentScene+"-2",EditorApplication.currentScene+"-3");
if (System.IO.File.Exists(EditorApplication.currentScene+"-1"))
FileUtil.ReplaceFile(EditorApplication.currentScene+"-1",EditorApplication.currentScene+"-2");
FileUtil.ReplaceFile(EditorApplication.currentScene,EditorApplication.currentScene+"-1");
EditorApplication.SaveScene(EditorApplication.currentScene);
EditorApplication.SaveAssets();
//Debug.Log("Auto-saved "+System.DateTime.Now);
}
}
}
Put that in Editor/AutoSave.cs and you’ll get 3 backup scenes regardless of the bugginess of a particular Unity release.
Just load your backup file
– Peter_GCouple of things. Are you doing anything weird that might cause Unity to behave weird (like running it in a program like dropbox)? And are you sure you were in the scene? (sometimes when you load up Unity it opens to an empty scene instead of the scene you were working in)
– anon82712216You make on in advance. Sorry, but it's a lesson a lot of us have had to learn the hard way =/
– anon82712216