Do NOT Restart Unity After a Crash!

It all started when my laptop went into sleep mode.
I was doing some play testing of my Dog Run game and had to take a work call.
I know I know “real” work getting in the way of my real life.

Something happened and the laptop stopped responding. Wouldn’t come out of sleep mode and had to be restarted.

Now normally Unity is pretty stable. I actually can’t remember any time when it caused a crash or stopped responding or has died on me but I guess being in run mode while the laptop was asleep may have been a contributing factor.

When I restarted my machine and opened my Game again in Unity the editor barfed and gave me an error in the console like:

GetPathNameExtension(path) == “unity”
GetPathNameExtension(path) == “unity”
GetPathNameExtension(path) == “unity”
Unknown error occurred while loading ‘/Scenes/MainScene.unity’.

Then it asked if I would like to open the default scene which I promptly took to be My default scene. But sadly it wasn’t. It was the Unity default scene that you see when you open up a new project.

All of my assets and settings were gone. All those hours of tweaking objects’ positions and rotations getting things just right were wiped off the board like an angry chess master.


This is the big lesson of today.

If the Unity Editor or your operating system crashes do NOT start Unity again without making a backup!

I know there are a few other lessons here like: 1. Always backup your project, and 2. Use source control, and 3. Backup your project again, and 4. Save your project regularly during your workflow and 5. Save the scene and the project BEFORE hitting Play when you are testing your game.

But I want to say it again because opening your project up after a crash in Unity is a really easy thing to do and seems like the right thing to do and is normal and natural and good. But it’s NOT!


Not without first backing up your project folders.

Now I know backup is a whole subject in itself and I’m going to make an entry on that soon but there are some simple ways to save the day here.

When you hit the Play button in Unity the scene and all the running elements are saved in the project’s Temp directory.

If you have a crash and want to restore your scene file, you cannot re-launch the Unity Editor after the crash.
If you do it will blow away the Temp directory and you will lose the last saved scene and all your progress with it!

Inside your Project directory folder there should be a Temp/__Backupscenes directory. If you are lucky in here you will find a file called either 0.backup or “__EditModeScene” (depending on Unity version) which is your saved scene file.

First! Make a backup of your Project directory. Take the whole thing. Easiest quickest way is to copy the whole project folder to another directory.

Then all you have to do is to copy this file back into you project and replace the broken scene file with the copy. Set the file extension to .unity in order to make this file recognizable as Unity scene file.

Please backup your project folder before making the change.

When you Run Unity and open the Scene you just moved from the Temp folder hopefully all or at least most, of your changes are there and the scene is restored.

So Unity is saving your scene every time when you hit the play button, but not over the original scene file, instead it is saved in the project’s Temp directory.

But be careful. You cannot start the Unity editor after the crash. This is by nature a Temp directory whose content is created dynamically when working in Unity.
If you restart you will lose the scene file and all the progress with it.

Once you have done this start using a new workflow.
Take regular backups.
Use source control.
Hit Save regularly while working in Unity.
Hit Save before you hit Play when testing in Unity.

2 responses to “Do NOT Restart Unity After a Crash!”

  1. I am at the border of quit programming because of this, 5 years have passed. Still the same.. Lost all day’s work

Leave a Reply

Your email address will not be published. Required fields are marked *