Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Unity erased nearly all our work.

Discussion in 'Editor & General Support' started by Kaprosamurai, Nov 21, 2022.

  1. Kaprosamurai


    Nov 8, 2022

    Sorry, I'm not smart at all, I just figured out that it was opening a new scene as opposed to opening to the preexisting scene. The level and all the work is there. Like I said, I'm just starting trying to learn game development and I made a super embarrassing mistake. I don't know how to delete this question, so I'm just putting up this update to anyone reading it. Thanks for clicking and God bless!

    We're trying to create a first person horror game, and we were following some tutorials from Zenva and admittedly did something we shouldn't have and tried to combine some of the coding we were taught from different genre tutorials that the instructor had for Unity. This lead us to some confusion, but our game was still working and the scene we had was functional right up until the last edit to the Player script.

    We had some error codes and figured we should probably erase all the coding from the other tutorial and retype it in verbatim from the one we were currently following. Again, our fault entirely. Obviously we weren't able to run the game then but we figured we could save it for tomorrow and went to sleep. We opened it up today to find out that the entire scene is now barren. A couple prefabs are still there, the script in question is still here, and the project still has the same name, but all the objects and whatnot we were working with disappeared and are nowhere to be found.

    Now when we went to open up the project a window asking us if we wanted to open up the project in safe mode because of a compiling error in the script 'Player' and we went along with it but didn't know exactly what was wrong in the code and tried to open it back up without safe mode and that's when we saw that all the scene was erased.

    Now it was about a few hours work, and it was a tutorial at that so it's not too much work lost, but we'd like to know what in the world even happened because it would suck if in a few months down the line with a serious project if everything just mysteriously and inexplicably deleted itself with no obvious reason. Is it possible to get our work back? If not, what can we do to prevent this from happening again? Because a minor error in the script for the character's camera movements not being finished or a value missing hardly seems like something that should erase your entire slate, especially since we opened it in safe mode.
    Last edited: Nov 21, 2022
  2. MelvMay


    Unity Technologies

    May 24, 2013
    Like everyone should always do, use source control for your project. It's widely available for free thesedays so there's absolutely no reason not to use it. It's invaluable as a team too.
    arkano22 likes this.
  3. Kurt-Dekker


    Mar 16, 2013
    ^ ^ ^ ^ THIS ... to quote another sage member of this board:

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards

    You wouldn't play a 2000hr RPG adventure without save system. Don't develop a one-year game without source control.

    I'm sorry you've had this issue. Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

    As far as configuring Unity to play nice with git, keep this in mind:

    Here's how I use git in one of my games, Jetpack Kurt:

    Using fine-grained source control as you work to refine your engineering:

    Share/Sharing source code between projects:

    Setting up an appropriate .gitignore file for Unity3D:

    Generally setting Unity up (includes above .gitignore concepts):

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place. Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It's simply ridiculous not to back up.

    Lost progress / project / work / stuff disappeared in Unity.

    This article is to help you when you have lost significant progress or work in your Unity project.

    It is designed to give you avenues of discovery and investigation.

    It is NOT a guarantee of restoring your lost work. It is NOT a substitute for proper IT / Data security procedures.

    To decide which parts are applicable to you, look for major bolded headings.


    Your project probably is still on your computer. Try a computer-wide search for some unique filenames that you know are in the project you think is gone.

    To start your search, one common file to all Unity projects is named

    Some things that might have happened:

    - you are not opening the project that you think you are
    - you are in the correct project but not opening the same scene you had open before
    - you dragged the project (or part of it) into the trash (intentionally or inadvertently)
    - you moved the project (or part of it) somewhere else (intentionally or inadvertently)
    - an overly-aggressive antivirus solution quarantined it because it saw code being compiled in there
    - you're using a directory sync like OneDrive or Dropbox... NEVER USE THESE SERVICES WITH UNITY!
    - something else??

    As I said, it's probably still all on your system to be found if you look in the right places.

    A typical Unity project will have at a minimum the following folders:



    Close Unity and make a full project backup RIGHT NOW. Do not do ANYTHING else until you back it up 100%.

    Ideally copy that backup to another computer, or back it up to another external hard drive entirely. This is just basic data processing best practices during data recovery operations.

    If you can see all the files and folders of your project, make sure you are opening the scene file you were working in.

    Once you have opened the scene, look in the hierarchy window, select an object and move the mouse over the Scene window and press F to focus that object.

    Additional notes:

    - ALWAYS use proper industrial grade source control (see below)
    - NEVER use Dropbox or any file sync mechanism in Unity.
    - NEVER move files within your project, except by doing it within Unity
    - ALWAYS be sure you are fully backed up before upgrading Unity


    Some info about Missing script warnings, broken prefabs, GUIDs, renaming GUIDs, etc:

    EVERYTHING in Unity is connected to the above GUID, which is stored ONLY in the metafile, and hence why the metafiles ALWAYS MUST be source-controlled.

    It is super-easy to inadvertently change it by renaming outside of Unity. Don't do that. Instead:

    - close Visual Studio (important!)
    - rename the file(s) in Unity
    - in Unity do Assets -> Open C# Project to reopen Visual Studio
    - now rename the actual classes, and MAKE SURE THE FILE NAMES DO NOT CHANGE!

    If you are NOT using source control while you do this, renaming files is an EXTREMELY dangerous process. Use source control at all times so that you can trivially revert if you miss a critical step and damage your project.