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.
  2. Dismiss Notice

Bug Unity 2021.3.16f1 just deleted the ENTIRE project when I opened it.

Discussion in 'Editor & General Support' started by Kraythax, Jan 4, 2023.

  1. Kraythax

    Kraythax

    Joined:
    Dec 31, 2022
    Posts:
    17
    Last night I finished working on my script for my controller. Closed Unity and left Visual Studio Code open. Today when I open the project all of the files in the project, settings, configuration and all are deleted. The project has been reset to how it was when I first generated it. No reason, no warning, no explanation. The only slight saving grace is the player controller was still open in VSCode at the time and it had a red line through the file name so it was deleted as well and only resided in memory. I saved the controller out into another directory.

    I searched the forum to see if I could get back the project and no dice. A lot of people were snidely commenting about backup. This was just a little demo but I did lose hours of work and saving, backing up and so on is all well and good but the reality is that this problem is UNACCEPTABLE for a professional project. I can just imagine if I had thousands of hours in this project how angry I would be.

    So the questions are.
    1. How did this happen?
    2. When will it happen again?
    3. Given I have seen many posts about this, does Unity even care to fix it?
     
    AldeRoberge likes this.
  2. Kraythax

    Kraythax

    Joined:
    Dec 31, 2022
    Posts:
    17
    The only bug in the console is

    <RI.Hid> Failed to create device file:
    2 The system cannot find the file specified.

    There may have been more but they might have been missed since I assumed i opened the wrong project and tried to open it again. I dont see any logs I can import on the project.

    I have captured what is left of the project in a .7z file. Please email me to get the file.
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    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.

    EVERYTHING IS GONE, YOU CANNOT OPEN THE PROJECT

    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
    ProjectSettings.asset


    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:

    Assets\
    ProjectSettings\
    Packages\


    EVERYTHING IS PRESENT BUT MY SCENE WINDOW IS BLANK

    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

    SCRIPTS OR ASSETS ARE MISSING OR BLANK

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

    https://forum.unity.com/threads/problem-with-git-and-missing-scripts.1090876/#post-7024801
    https://forum.unity.com/threads/scr...ead-after-loading-editor.998413/#post-6487297
    https://forum.unity.com/threads/scr...ead-after-loading-editor.998413/#post-6488230

    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.
     
    Noisecrime likes this.
  4. Kraythax

    Kraythax

    Joined:
    Dec 31, 2022
    Posts:
    17
    None of this is the case. I have been programming for 39 years, I already did a check of where it might have been moved to or deleted. Nothing indicates it was. Unity just ate the files somehow. I didnt have thep roject under source control as it was just a demo anyway. However that wouldnt have helped. As for closing visual studio I am glad I didnt do that as the one asset that was important, the script, was still open and in memory.
     
    AldeRoberge and nasos_333 like this.
  5. darkgriffin

    darkgriffin

    Joined:
    Nov 2, 2009
    Posts:
    113
    Just got this bug myself today. Posting what I got in the hope it helps find the cause.

    I had been opening and creating projects (prototypes) with the HUB today. I just closed my work project, which gets source control backup, and swapped to opening a project that I had imported several entire game engine stuff into (Moremountains 2D platformer engine, and prerequisites last night).

    Entire folder is EMPTY, Unity HUB acted on start as if starting a brand new project. Entire prototype is reset to the new project folders, Assets/ is entirely empty aside from template files.

    Nothing in trash, nothing in any of the locations Kurt suggested looking at. Unity HUB literally seems to have wiped the Assets folder, imported kits from the asset store, everything, clean to the template settings again.

    Since the project is just some unity asset store stuff and untouched stuff, I'm uploading the project and screenshots of the resulting folders. I had no backup, as the project is just a prototype started yesterday and I was just playing around learning the platformer engine kit.

    ---

    I had noticed one other odd thing earlier today; the HUB had tried to open the wrong project.

    Specifically, I had opened the SECOND slot in Unity HUB, but the project opened instead was the FIRST slot (which was THIS prototype).

    The only reason I caught this was because the prototype is made using an older version then the work project, so it had prompted to "upgrade" the wrong project. I had cancelled the upgrade, opened my work project, and everything had seemed to be normal. But of course, I didn't think to check the prototype folder till after my work was done, so it may be wiped from that mistake instead.

    (Before Kurt suggests it, yes, I know for sure it was the second slot I selected when HUB opened wrong. I opened the project using the version selection drop down on the second slot, as I always do, just to make sure I do not open the wrong work project or wrong version of Unity editor on a project.)

    Also, opening the prototype after work, Unity asked me to select a version of Unity Editor to open the file with. It's current version was just 2018.3.11f1 which is just the lowest version I have installed. So I think HUB may be failing to read the versions of projects in certain use cases/project combinations. Of course now it just is a blank with the latest LTS version I had installed because I could not remember what I had prototyped in (I have about 20 installed due to contractual work.) And when it "Upgraded" the project it was fast, so I think the project was already wiped by then.

    The HUD might be getting IDs or project entries mixed up somehow when starting editors.

    Here is the current directory screenshotted after the error. As you can see the library and other files for the code project are there, BUT critically, none of the Assets folder exist anymore (the folders and files there are just what comes with the default 3D project template)

    WipedProjectFolders1.png WipedProjectFolders_Assets.png Library_Folder.PNG

    I've also uploaded a zip of the folder in case you want to poke around yourself:

    https://drive.google.com/file/d/1kcR1ENbVDChZ_A9-5gx1NEkQVxlYTHwP/view?usp=share_link

    Just gonna add this here as well:

    Unity Hub 3.4.1

    Editor Versions (In case it matters, I suspect this might be a HUB issue though):

    For prototype that was wiped: Originally maybe 2021.3.9f1? That is usually the version I prototype in, but when opening it today selecting that made it have to "upgrade" the project.

    For work project: 2020.3.16f1
     
    Last edited: Jan 5, 2023
  6. darkgriffin

    darkgriffin

    Joined:
    Nov 2, 2009
    Posts:
    113
    Hmm, I also just found a backup (Thank you iDrive!) of where I had it last night. Should I upload this as well? The assets folder/project technically contains paid for assets, but comparing the two states might help and having it as a testing project could debug the problem.

    The backup timestamp is at 4AM, so after I closed it in the editor (stopped around 1AM) the files were still there in Assets.

    I'll edit this with more info about the before project after my backup software gets me the files back.

    EDIT: Minor oddity found while waiting. Even though the wiped prototype project is completely closed, I cannot rename the project folder. I get a "file in use" error. Both Unity Editor and Visual studio are closed at the moment. Only the HUB is open, but it's minimized to the task bar so shouldn't even need info from a project to work right now.

    This isn't ideal behavior at all, as it means something is locking the project down even with supposedly "no operation" being done.

    By renaming folders I have found the locked file is in ProjectSettings. Still narrowing this down further. But it seems odd that something would be locked in the first place after Hub is just minimized. EDIT 2: Actually the locked file appears to BE ProjectSettings folder. I can rename anything inside the folder just fine. But cannot rename anything up above that level in the folder path, as if something in that path is still in use.

    EDIT 3: Ok, project information time!

    Version is indeed 2021.3.9f1

    Files included BEFORE nuke:
    The missing screenshot for library is because it was the same, which makes sense since the game hadn't been run/compiled between the backup and crash. Of course, the Assets folder is really where everything lives, so kind of important not to wipe it!)

    Backup_AssetsFolderContents.PNG Backup1.PNG

    Of important note is the COMPLETE WIPE of the assets folder between opening. Hub seems to have indeed forced the entire Asset folder directory to mirror the old project setup, instead of leaving the user files alone.
     
    Last edited: Jan 5, 2023
  7. darkgriffin

    darkgriffin

    Joined:
    Nov 2, 2009
    Posts:
    113
    Completely random thoughts. Does it have to do with importing a plugin that comes with full wiping of a project?

    For example, Corgi Engine (the one I am using here) basically is meant to import on an empty project, then WIPES out the project settings files. (Because of layers, rendering settings, and so on.)

    I'm wondering if this import operation makes HUB unable to understand what version of the editor the project was opened with last, or even worse, unable to identify the project was built at all. But I would need other users to confirm/deny if this was the case. I had imported Corgi Engine and then done all my prototype editing in a single session.

    This was also the first session of editing before I closed it last night. Wondering if maybe some combination of new project + import or fail to save project in menu is making hub break.

    Another unlikely thing to check would be time/date changes with HUB opened before midnight and then reopening the files the next day. Most likely not the culprit but at least in my case I hadn't restarted my system or closed HUB between yesterday and today.
     
  8. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,084
  9. darkgriffin

    darkgriffin

    Joined:
    Nov 2, 2009
    Posts:
    113
    I just opened my backup (well, a copy of it) in Hub, and it read the version on the backed up project, and loaded everything in. Phooey, I was hoping that would recreate the problem.

    Might be more related to use of Hub or version/project swapping, some combination of creating new projects + opening older ones. My project that broke is too large for me to test/experiment with further for now. Seems random for now on my end.
     
  10. CassClay

    CassClay

    Joined:
    Mar 21, 2020
    Posts:
    20
    Recently closed a project without doing anything to it. As far as I am concerned it was finished. Put a bit of distance in time to look at it with fresh eyes before release. After I launched Unity it started giving errors in Scripts written by Unity staff itself. Purged the project and then started new build which failed to build Gradle. By the time I finished the project and the final build I've only connected one Android device for backup. As it seems something jumped over and corrupted the Android SDK. Consider it being something trivial as malware that jumped over from another device.
     
  11. Kraythax

    Kraythax

    Joined:
    Dec 31, 2022
    Posts:
    17
    In my case there was no malware involved. It was unity that did that.
     
  12. chemicalcrux

    chemicalcrux

    Joined:
    Mar 16, 2017
    Posts:
    717
    Have these issues only been seen on Windows? I know that doesn't mean much, since I imagine it's the most popular platform by far, but that would help to narrow things down.

    So, when you tried to open the project, it gave you that "pick a template" menu? I've been trying ripping random parts out of a project and seeing if the Hub does this, but I haven't observed anything like that yet.
     
  13. Kraythax

    Kraythax

    Joined:
    Dec 31, 2022
    Posts:
    17
    I was using windows when I tried this.
     
  14. darkgriffin

    darkgriffin

    Joined:
    Nov 2, 2009
    Posts:
    113
    Yes, I'm on Windows 10 64 bit as well.

    It did not show any pick a template menu when it wiped the project. It just opened the project as if normal and seems to have reset to loading in the template instead. It looked like it was just loading the project as normal but then finished a bit faster and the project assets were back to the start once opened.

    You might be on to something regarding templates menu. Because I often open the create new project template and ALMOST create a new project, before backing out. I do that so I can view what templates there are to start with. Maybe there is some way hub gets stuck thinking it is still creating a new project, instead of opening an older one, and then launches the editor with the wrong launch options. I often use only like 2 of the templates though so can't be sure if the template it loaded was what I first had in the project or what I had selected during the "almost setup".

    Unfortunately, I do have work projects here at the moment, so I cannot afford to test breaking it. They are all backed up, but there is still all the restoration time spent pulling the project back from the cloud/git/etc. I wish you the best of luck!
     
  15. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,904
    This is a massive known issue for some time now, i got this 3 times and was not pretty

    https://forum.unity.com/threads/all...unched-through-unityhub.1157303/#post-8692590

    This and the graphics random Swapchain crashes are massive issues and still propagate from version to version.

    Unity must stop immediately any further features development and focus on fixing 2021.3 LTS for those crazy issues and the editor delays, before even remotely consider progress on new versions etc

    If a glass is broken to 1000 pieces you don't continue trying to put water to it. At least must try glue it back together first. That glass is Unity 2019 btw, the last known very stable and fast Unity version. Unity 2018 was even better, but at least 2019 did not have such massive issues like 2021 version.
     
    Last edited: Jan 7, 2023
  16. aitchest-of-dees

    aitchest-of-dees

    Joined:
    Dec 28, 2013
    Posts:
    71
    This is exactly what happened to me. I clicked my 2nd slot project and it opened the 1st project. I remember cursing about it wasting my time, closed the incorrect project and loaded the 2nd. I've been working on that one for a few days. I went back to open the first project and it's magically disappeared without a trace. The folders I created and all the files under Assets that I added are gone. It's a new blank project. I've never experienced anything like this in 10 years of using Unity. Fortunately the project that vanished was just a demo scene I had set up with a few assets in it, and the other projects have all been backed up regularly. But what the LIVING CRAP IS GOING ON?? The folders are missing! How? It's like Unity is gaslighting me.. o_O
     
  17. AldeRoberge

    AldeRoberge

    Joined:
    Jun 23, 2017
    Posts:
    48
    Just happenned to me. Good thing I was pushing every changes to GitHub defensively.

    If this happenned to me as a beginner, I would've quit Unity. This bug is a MAJOR problem. What the actual f***?

    If this can help to reproduce the bug in question, I was trying to open another project of mine, and it said "This project is currently opened. Only one instance of the project can be opened at the same time.", but it wasn't.