Restoring a lost scene in Unity
FYI – This mostly applies to folks using Macs.
Well shit. Losing progress on a project is bound to happen to you at some point in your career. Whether the application hangs and you have to restart or the power goes out, you’re bound to experience some bad luck once in a while. Turns out that was me this morning.
I sat down to continue work on a third-person scene I had been developing and Unity pulled up with some very old geometry in the scene. A minor heart attack ensued. WTF? We had had some very strong wind in the Seattle area a couple nights back and the power had gone out a few times. I work on an iMac and there’s no fancy battery backup so the machine went down. And guess what?
Unity does not autosave
As a new user of Unity that was news to me. Now I’m a habitual cmd+s smasher. The problem is I was saving after writing code in Rider, but hadn’t gotten into the habit of saving everything when I was back in Unity. This meant that I had all my scripts saved, but a good majority of my geometry was gone. Yikes.
You’re using Time Machine, right?
Okay, so you’re borked. The good news is you’re a good little computer user and have Time Machine (or some form of backup) running and can reclaim some missing files. Here’s what you do to save yourself.
- Navigate to your project in Finder and then Enter Time Machine.
- Go backwards in time to a point just before the crash, power loss, etc.
- In your project folder you should have a file:
Temp/__Backupscenes/0.backup
- Restore that file to your
Assets/Scenes
directory and rename it to something with a .unity extension. E.g. MyScene.unity. - Open that scene in Unity and breath a huge sigh of relief.
Note: if you have a project with lots of scenes you may have to play around with the temp files to determine which one is the one you’re looking for.
Moral of the story
Save in both your IDE and Unity. There also appear to be some AutoSave tools in the Asset Store and scripts floating around that you can add to your project to gain autosaving functionality. Hopefully Unity will work this into their core at some point. Seems important.