Search Unity

All assets deleted / project reset when launched through UnityHub

Discussion in 'Editor & General Support' started by julesbro, Aug 16, 2021.

  1. julesbro

    julesbro

    Joined:
    Feb 7, 2014
    Posts:
    2
    I read through the threads on this already, and I think this warrants some investigation:

    I'm using Unity 2021.1.16f1 with Visual Studio Integration 2.0.11, Visual Studio 2021 Preview, Unity Hub 2.4.5. A couple of things first:

    1) I CTRL-S constantly
    2) I ensured I had no dirty windows before closing Unity
    3) I closed Visual Studio before closing Unity
    4) No source control was active on the project or any child folder

    I tried to attach to Unity to debug a script. I got a dialog box saying "Unspecified Error" and was unable to debug. I tried several times, saving, closing Visual Studio and re-launching, but no luck. I had other things to get to.

    In this order:
    1) I closed Visual Studio. When I shut down Visual Studio, I ensured that all my windows were clean - all changes were committed to disk

    2) I manually saved the scene in Unity and closed the editor without any warnings

    Some time passed. I re-opened my project through Unity Hub (as usual). The project opened as if I had just started a new project from Unity Hub.

    1) All assets I had created including scripts and prefabs were deleted
    2) All package changes I had made (imports, updates) had been reverted
    3) The /_Temp folder in my project was cleared

    Interestingly, the .csproj file I had generated when working in Visual Studio was still present. Opening the project file directly in Visual Studio clearly shows what the contents should be, but Visual Studio reports that the files are no longer present.

    This affected both files that were open in either editor, as well as files that were not: Files_gone.PNG

    To be clear, this appears to be a scorched-earth overwrite of the entire project folder with a completely clean, new template.

    A few observations:

    1) If this was a file-handle / lock issue, it would only affect open files. Since this is not the case, I believe this explanation is out.

    2) The package manifest.json file was overwritten. Of particular interest, all added packages were removed, and the specific upgrade of "com.unity.ide.visualstudio": "2.0.9" to "com.unity.ide.visualstudio": "2.0.11" was reverted. Additionally, the packages-lock.json was reverted.

    3) The Assets folder's Date Created and Date Modified were reverted to both be the exact same date and time I tried to re-open the project. The SampleScene.unity and SampleScene.unity.meta in the Assets/Scene folder had their Date Created set to the same time, but their Data Modified was reverted to 4/17/2020 @4:35 AM.

    Based on this, I can draw a couple of conclusions:

    1) This is not a file lock issue: it affected all files in the project, open or not as well as reverting changes to dates and times on folders and files created during project scaffolding

    2) This is not a source control issue: no source control mechanism was in place

    3) Visual Studio was closed before Unity was closed. Since Unity did not report any errors while I was saving my work, I can conclude the Visual Studio was not involved in the project corruption. This is further supported by the fact that artifacts specifically in use by Visual Studio (the .csproj files) are intact and in the correct state.

    4) This was not a result of a reported error in Unity3D. Shutdown was clean and reported no errors. Attempting to save a locked file would result in a lock violation in Windows. A search in Event Viewer for any errors related to the Unity3D app yields no results.

    Given the above, I strongly suspect that there is an issue in the Unity Hub project launcher that resulted in my project being re-created. Any files or folders present in the template are cleanly overwritten including OS files system metadata. This did not result in my .csproj files being overwritten because those files are only touched when Unity is configured to generate them, and you either click the 'regenerate' button, or shell out to Visual Studio to edit a script. They would not be present when being copied from the template.

    I'm happy to provide any additional information I can. Hopefully someone will be able to use this to locate this bug.

    I did notice that my time zone on my system updated today. I don't know if that would be significant or not. Good luck bug hunting!

    Jules
     

    Attached Files:

    BjoUnity3d and Tukoda like this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    First thing I would look for is an overly-aggressive antivirus solution quarantining the entire directory because it saw some DLLs being written there when Unity compiled your scripts.

    This is likely the root of your problem. I'm sorry you've had this issue. Please consider using proper industrial-grade 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.).

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

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

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

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

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

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

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

    https://thoughtbot.com/blog/how-to-git-with-unity

    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.

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

    julesbro

    Joined:
    Feb 7, 2014
    Posts:
    2
    Thanks for the reply - however this was more of a bug report than a cry for help. I definitely agree: anyone finding this thread, turn on source control. It will provide (some) protection against this!

    On another similar thread, a reply suggested that a faulty source control may have been the issue. The presence or absence of a .git folder should not affect whether one of the Unity runtimes nukes a project on startup. I think it's a relevant observation that this happens with or without source control. Since I happened to observe the behavior before I turned on source control, my report helps to eliminate a possible cause: source control.

    In short, yes, I agree that using source control and pushing to a remote regularly is best practice. However, somewhere lurking here is a really evil bug, and using source control to guard against it is a work-around. The root of this is that something in the behavior of part of the project system sometimes results in the overwrite/deletion(?) of files in the project folder. It's fortunate that the .git folder seems to be spared, but depending on where you are in a stage/commit/push/pull/merge cycle when your project gets nuked, you can still end up with a broken local repo.

    I've been trying to repro this a little without much luck. I did successfully get it to happen once by:

    1) Opening Unity Hub
    2) Creating a new project and launching it (Unity Hub automatically minimizes)
    3) Close and re-open Unity Hub while the project was loading
    4) Making some edits
    5) Saving my edits
    6) Closing Unity
    7) Opening the project from the newly running instance of Unity Hub
    8) Observed complete reset of project (folders not originally set up by Unity remain intact, including .git)

    I was doing a git init during my attempts to reproduce; on this run I turned it on after step 5 and committed.

    One observation here is that while git observed this as a change, resetting to HEAD would still result in losing anything not yet committed. This includes changes to the package manifest.

    Unfortunately, the above only worked once for me: two subsequent attempts did not reproduce the issue. My suspicion is that it has something to do with Unity Hub incorrectly determining the state of a project, and scaffolding a new project over the existing one. I don't know what's happening under the hood, so it could have a lot to do with the timing of the actions I listed. Variability in when I get my clicks in, system resources and load might be heavily affecting reproducibility as well. When I have time, my next idea is to substitute step 3 with initiating a Unity Hub update. If do successfully dial in steps to reproduce reliably, I'll post them here.

    For now, all I have is a suspicion.

    Based on my observations so far, you should be able to successfully mitigate this by ensuring you commit and push before you re-launch your project. This is a little counter-intuitive, since we're generally used to committing and pushing after we save changes we're happy/done with.

    If you close your project, the editor crashes, or you close and do something else (like work in VS, Blender, etc.) and want to come back to it, be aware that it's the files in the project folder not committed before launch that are potentially exposed. Once you click the project launch button, if the dragon happens to be there, it's too late.
     
  4. unfitforbingo

    unfitforbingo

    Joined:
    Jul 28, 2017
    Posts:
    3
    Yeah. Appears to be an issue. I just encountered this as well. Everything wiped back to a previous state after restart from Unity Hub.

    To an amateur playing with Unity just for fun, without version control, this could be traumatizing. Or even if you're just prototyping a bit before setting up a proper project. Many situations where you won't have VCS set up yet and lose a bunch of work for no good reason.

    What seems crazy is the Assets are wiped from disk. Not just Unity's view of the project structure. Some task on startup has the authority to completely scorch earth the Assets folder. This should never be allowed without taking some kind of backup first. Way too dangerous.
     
    Tukoda likes this.
  5. Friedemann_A

    Friedemann_A

    Joined:
    May 11, 2017
    Posts:
    11
    What on earth!? This just happened to me while prototyping for a project. An entire day's work is gone now and I'm feeling extremely paranoid. Setting up source control for every one-day-prototype during a rapid ideation phase creates a lot of overhead so I'd like to avoid this.

    Also, I don't feel like I should have to put up safeguards against the engine I'm using deleting the entire project.
     
    Tukoda and dunk7 like this.
  6. sclausen

    sclausen

    Joined:
    Jun 3, 2020
    Posts:
    1
    I just encountered this too. Early prototyping phase and no source control off course
    unfortunately, I stored some models exclusively in that project.
     
  7. Zarkow

    Zarkow

    Joined:
    Jul 27, 2015
    Posts:
    92
    I just encountered this, first time ever after years of using different Unity versions. Happened when launching Unity 2020.3 -- thankfully a full backup archive (with all assets as textures etc etc) and a checkin to versioncontrol with all meta-data, scripts etc saved me, because I almost S*** my pants...

    Edit: Should mention that I just restored all data to disk, and now launching the project again and it is doing a lot of processing to 'import' all assets, so not 100% there yet that everything works incase Unity messed up some local file and tries to recover by itself by resetting all to blank project... if it does, I need to start over and manually introduce all files again...ufffgh...
     
  8. heymrred

    heymrred

    Joined:
    Feb 11, 2020
    Posts:
    1
    I can confirm, this has just happened to me as well, Unity completely nuked my prototype, I was only ~4-5 hours in, but still sucks. Recovered most files with Recuva, but that's no good, too many are corrupted, gonna have to start fresh. The logs don't mention any delete.
    This is definitely a bad bug, there have been reports of this ever since 2014, which unity chose to ignore.
     
  9. sheng_the_cool

    sheng_the_cool

    Joined:
    Sep 27, 2017
    Posts:
    1
    This just happened to me. See you later weekend prototype... The one time I didn't immediately set up source control as well.

    My recollection of events:
    1. New 2021.2.8f1 Unity project from 3.0.1 Unity Hub.
    2. Worked on and off the project without ever restarting Unity for a few days.
    3. Tried to do a build but got this error:
    Read that a simple restart of Unity will fix the problem.
    4. Save everything, Close Unity.
    5. Launch project again from Unity Hub.
    6. Build.
    7. Open apk and sees the default table saw scene on my phone...
    8. Check project and find everything nuked.
     
  10. lukewebby

    lukewebby

    Joined:
    May 14, 2019
    Posts:
    2
    This also happened to me yesterday :(

    Recollection of events:

    1.) New project, work on it for 2 weeks. (Unity is perma open)
    2) Hit build and run, and it runs ok
    3) Back in unity, hit play, and for some reason, all the Sprite Layer orders are wonky. ( I theorise now, they are all set back to 0 and any changes are lost)
    4) Correct them all and hit save. Try to close or switch the scene, but it wont close. (At this stage, I can still hit play no problem!)
    6) Try to save as the scene so I have 2 copies, but it wont save. (the window closes, but no file is made)
    7) Think thats weird, close unity and reopen.
    8) I have a fresh project, with just one asset, that I had added and then deleted from the project, about 2 days ago. All other(100 or so assets, scenes, animations, created both before and after this rejected asset), are gone.

    9) Setup source control, on next project :)


    Follow Up:

    I had OBS left recording for a couple of days and it had made a 2.4TB mkv file, before filling the HDD up that was shared with my project, so I imagine it ran out of space and unity got nuked.
     
    Last edited: Feb 23, 2022
  11. Golesy

    Golesy

    Joined:
    Apr 10, 2013
    Posts:
    35
    Just had a prototype get nuked as well. Not even a recovery porgram is finding the data.
    This is one scary bug...
     
  12. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Your project is almost certainly NOT "nuked." Some things that might have happened:

    - you are not opening the project you think you are

    - you are not opening the same scene you had open before

    - you dragged the project into the trash (intentionally or inadvertently)

    - you moved the project 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... DO NOT USE THIS WITH UNITY!

    - something else??

    Whatever the result is, it's probably still all on your system to be found. Search for some filenames you know are in the project you think is gone.

    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:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

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

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

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

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

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

    https://thoughtbot.com/blog/how-to-git-with-unity

    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.

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

    allen_unity864

    Joined:
    Jul 21, 2020
    Posts:
    1
    Happened to me. I was done working on a prototype; went to close out VS/Unity & check into git. Found out I had a missing item and needed to do a rebuild, opened Unity back up and everything is gone. Library still has artifacts of build, but everything in Assets is nuked.
     
  14. rscopic

    rscopic

    Joined:
    Jul 3, 2018
    Posts:
    2
    Just had the same thing happen to me. The project is very much nuked. I'm using Unity Hub 3.1.1 on Linux. Fortunately, I only spent a few hours on it

    Reviewing the the editor log, the following line is part of the "COMMAND LINE ARGUMENTS" list:
    Code (CSharp):
    1. -cloneFromTemplate
    2. /home/user/Unity/Hub/Editor/2021.3.1f1/Editor/Data/Resources/PackageManager/ProjectTemplates/com.unity.template.3d-8.1.0.tgz
    Did it just re-clone the template over my existing project? I opened the project directly from the hub's project list

    Edit: This just happened to me again (about a year later) when using Unity Hub 2.4.5 so it's not an issue with Hub 3.0 as I thought. The project was wiped after I signed back into my account and opened the project through the Hub. I had the project open moments earlier trying to build but received an error about my account's authorization/permission not being valid.
     
    Last edited: Mar 22, 2023
  15. Dragoon112

    Dragoon112

    Joined:
    Apr 22, 2013
    Posts:
    1
    Have had this happen three times previous times had git repo just restored project.
    Steps i did to have this happen to me.

    1) Installed new unity version 2022.2.0a13
    2) downloaded 3D(URP) template and created new project "ProjectA"
    3) Imported some models and animations
    4) Wanted to open other project to compare some settings unity hub was complaining that "ProjectA" is already open i made sure i am opening different project.
    5) closed opened project and it reset itself.
    6) afterwards i am able to open both prjects fine but "PrjectA" is just empty files were not in recyclebin.
     
  16. yorrickm

    yorrickm

    Joined:
    Mar 3, 2020
    Posts:
    1
    +1 for happened to me. Absolutely everything is nuked and honestly I can't really believe my eyes. I've never seen or heard of a software that is work related for most of us absolutely nuke the project folder. It's shocking. I think the engine itself has been around for years but the hub that's tacked on seems to be the culprit

    "oohh use source control". I do, but I commit at the end of the day or every few hours. Losing hours of work is annoying af. Using a mac which from the looks of the folder paths seems to be the common trend here.

    My timeline:
    Hit an infinite loop in the editor script. Force quit unity and I can't quite remember how I tried to launch it again, might have been the hub. Boom everything nuked and visual studio helpfully went back to the last git version it had.

    Not sure if it is relevant but I did also a see a 'project X is already open' as well compared to ^
     
    Last edited: Jun 2, 2022
    dunk7 likes this.
  17. KingTeehl

    KingTeehl

    Joined:
    Jan 7, 2020
    Posts:
    2
    This just happened to me too... Just did a fresh prototype for two hours, nothing major but a pain to lose when you are on the clock.

    V 2021.2.7.f1
    URP

    Saved many times, imported assets, created folders, changed settings etc.

    Unity crashed, I restarted the project via Hub and it was fresh as the minute it was created...

    The relevant SSD had 25GB left, which this project was not.

    Don't think GIT would have helped here because Unity is just not saving anything in the first place. Everything must have been in temp and wiped when I restarted the project...

    RIP.
     
  18. longlu

    longlu

    Joined:
    Nov 5, 2018
    Posts:
    1
    same issue, had a prototype project open for 2 weeks was noticing slowness in loading assembly, saved everything and restarted the project , it took a long time to load and was performing some sort of copy, I let it run overnight, then the next day, everything was gone back to a sample scene, hundreds of scripts and assets were removed without a trace
     
  19. dunk7

    dunk7

    Joined:
    Jun 21, 2019
    Posts:
    1
    yup, just lost my entire project I spent 8 hours on. Thanks a lot unity, this was my first game, and I was just about to test it out on my phone. I created an entire game and EVERYTHING is gone...
     
  20. CosmicCricket

    CosmicCricket

    Joined:
    Jul 4, 2018
    Posts:
    3
    Just ran into this issue. Source control doesn't help when you're still testing out changes that you're not ready to commit.

    Not a good look.
     
    GRaALe and phazonxiii like this.
  21. phazonxiii

    phazonxiii

    Joined:
    Aug 24, 2020
    Posts:
    2
    Heyo - been happening to me, too. Except one difference: when I click on an older project to open, maybe something 2 or 3 places down, the Hub will instead open the most recent project I was working on, but completely wiped. All assets I've imported, all folders I'd created - just all completely gone.

    Sometimes it'd seem like using the OPEN button and opening manually would work, but after a project is nuked...ugh.
     
    nasos_333 likes this.
  22. samfss

    samfss

    Joined:
    Apr 10, 2019
    Posts:
    16
    I had this happen to me a couple weeks ago. Opened a project and it reloaded the template instead. Unity seems to not bother checking for existing project assets before applying the project template and nuking everything.
     
  23. mvriel

    mvriel

    Joined:
    Mar 17, 2015
    Posts:
    13
    I can confirm the above, I created a new project using the URP template, imported assets and did some prototyping and upon closing and reopening the project the files were literally deleted from my hard drive.

    I know this because after reopening I reimported the assets and in File Explorer kept tabs on my project folder, and after reopening the project this morning all files were gone again. From that same folder I was monitoring with File Explorer
     
  24. flyingplumestudios

    flyingplumestudios

    Joined:
    Nov 8, 2022
    Posts:
    1
    I just started a course on Unity Learn. Opened another project. Closed it. Launched my course project from the hub and a blank sample scene is all that was there. No models, no scripts. I went to Open Recent Scene and it's greyed out like it's not on the disc anymore (it's not).

    upload_2022-11-8_22-36-45.png
     
  25. TeamDefiant

    TeamDefiant

    Joined:
    Mar 29, 2017
    Posts:
    50
    I sound like Spartacus here, but the same happened to me using Unity 2021.3.13f1

    Opened the AR template, spent a few hours getting the project working. Files existed outside of unity as I dragged assets in using windows explorer, built a working mobile app, went to be, went back in today and everything has been reverted to the basic template and an empty scene.

    Now I'm scared to open anything in case unity decides to wipe that as well!

    Not cool Unity, not cool.
     
    Zarkow likes this.
  26. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    Exactly, how to trust open any project after this, is just crazy.

    I have got this 8 times so far, latest in 2021.3.6f1 today, opened new project, imported ORION asset, did some work on scripts and closed. When reopen had a strange wait long time and was because was reimporting all new project stuff, and all was wiped clean when entered.

    This is borderline UNBELIVABLE to say the very very very ... billion very here .... the least.

    An official word on this would be super welcome, so we know if someone is looking at it at least.
     
    Zarkow likes this.
  27. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    Hm, that is important info, come to think of it what actually happened to me today was that i think i pressed on my main project to open and sonehow opened the new helper one and reset it.
     
  28. AtlasVenture

    AtlasVenture

    Joined:
    Nov 18, 2022
    Posts:
    1
    Still happening. Nothing official saying why?

    New to the platform. Lost 3+ days of work. Literally saved all the time. On a Mac using 2021.3.13f1.

    No crashes, it was just acting slow to compile and start the game. Saved it. Closed out of Unity. Launched the project from the hub, things were there and then they just blanked and I lost everything. Asset folder gone.

    Obviously, if this were something major, like work, I would have setup more safeguards. Didn't think the program was going to nuke my project.
     
  29. Zarkow

    Zarkow

    Joined:
    Jul 27, 2015
    Posts:
    92
    My recommendation, that I started doing, is to start a new project - don't do anything yet. Shut down Unity once it has started up. Do a full backup of the folder (as I also set up source repository/code versioning too).

    Load project again from the Unity Hub.

    Maybe just a coincident, maybe it helps but so far - knock on wood - it has allowed me to dodge the issue further.
     
  30. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Not new to the Unity3D platform, been using it for over one decade now. Yes, since 2012.

    I'm a professional working on big teams of people, making commercial game software for iOS and Android.

    I work with a LOT of repositories, always using git. I open other teams projects, fix their bugs, pull their modules out to use in my games, we use Unity HEAVILY. Our entire "shop" is Unity3D now.

    I log around 1000 to 2000 hours per year working in Unity in one form or another.

    Not even one time, NOT ONCE have I ever witnessed Unity destroy a project.

    I have seen people drag projects or folders into other folders or their recycle bins. That's not on Unity.

    I have seen antivirus quarantine entire directories because of false positives. That's not on Unity.

    I have seen hard drives crash and corrupt filesystems. That's not on Unity.

    I also don't install drive sync tools because I know they are not compatible with Unity. Again, Unity says that explicitly.

    I'll post it again, just in case you missed it.

    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.

    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:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

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

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

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

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

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

    https://thoughtbot.com/blog/how-to-git-with-unity

    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.

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

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    You have not witnessed this issue i suppose, the files are not somewhere in the PC, they are completely wiped out from everywhere. It does not make any sense to be somewhere also, for sure is not in trash or temporary folder.

    Maybe if save it all before close Unity and have it online in github, can somehow recover it, but i would not trust that project anyway, too much uncertainty.

    Also i too worked in Unity huge hours for 8+ years now and only recently have had this kind of issue, so is something they did on latest versions. Same as the infinite new wait times and myriad other issues that Unity 2019 just did not have.

    Is just the general way of Unity upgrading in last years, put too much new things with zero testing and break everything, then not fix it and propagate the issues to next even more broken versions. There is so many new critical issues that i have lost count and what scares me is that i saw there is a Unity 2023 in the github, like everything is fine with Unity 2021.3 and we can move on to next more broken versions.

    Bottom line, not everyone uses source control, some just want the easy way of backup the project every now and then and the platform should be stable and fixed for such critical issues, like make a whole project disappear out in thin air.
     
    henrypaul2001 and Tukoda like this.
  32. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    seen probably hundreds of these threads already,
    at least some of the things that can happen are (for OP)
    - if your project is under Hub installation folders or Unity editor folders, updating hub/unity will remove those folders without questions
    - If you scene is SampleScene.unity, importing/updating some unity packages/samples will overwrite that scene without questions



    Last resorts:
    - If you had played your scene AND after that your scene is deleted/overwritten, DO NOT press play, but go into "ProjectFolder/Temp/__Backupscenes/" folder can copy "0.backup" as your scene
    - Try free undelete tools.. i've had some luck with them before. (not unity project though)
     
    Last edited: Dec 15, 2022
  33. Zarkow

    Zarkow

    Joined:
    Jul 27, 2015
    Posts:
    92
    If you have no clue, don't post.

    This is the second time and you are making a bigger fool of yourself each time.
     
  34. KarelA

    KarelA

    Joined:
    Dec 30, 2008
    Posts:
    422
    wow. I have been using Unity since 2008 and this just happened to me. 12 hours of prototyping just gone. I reopened a project and suddenly everything is in blank state. Google led me here. Yes can confirm that everything is totally wiped. Never in my 14 years have i seen anything so absurd
     
  35. Stingyhat

    Stingyhat

    Joined:
    Dec 31, 2014
    Posts:
    1
    Just happened to me as well. Several hours of prototyping up in smoke. I had no idea this was a thing. Is there a formal bug report written up for this? This seems huge...
     
  36. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    Is indeed one of the most severe issues, alongside the new swapchain huge bug that can randomly crash the game at random gpu configs, leaving the engine completly unreliable.

    These two are a deal breaker for making any serious project with Unity 2021 and above until fixed. I wonder why even a single unity developer is at making new features and Unity versions when the engine is a complete wreck at the moment.

    We dont need more features, if Unity is completly broken.
     
  37. blackfritz

    blackfritz

    Joined:
    Sep 13, 2018
    Posts:
    9
    Have anyone got any solution to this? My project just got nuked beyond help!!

    I'm unable to reproduce but here's my step
    0) Have a lot of other projects already opened for reference <- might be the culprit
    1) Opening Unity Hub, install 3D URP Template
    2) Creating a new project (3D URP Template) and launching it (Unity Hub automatically minimizes)
    3) Sign in to Unity web api after the project load, because I can't access my package manager in editor without signing in (My Unity Hub is already signed in btw, I don't know why the editor is not signed in).
    4) Install starter assets 3rd person, which require to restart unity because it needs to import new Input manager
    5) Making some edits in Visual Studio
    6) Install Jetbrains Rider
    7) Saving my edits regularly
    8) Closing Unity
    9) Opening the project from the already running Unity Hub
    10) Observed complete reset of project (it looked like a new 3D URP Template)
     
    Last edited: Dec 29, 2022
  38. blackfritz

    blackfritz

    Joined:
    Sep 13, 2018
    Posts:
    9
    You are not helping our problems. This happens to me just recently, once in 5 years, but it is very crucial issue Unity should solve
     
    BjoUnity3d, Zarkow and nasos_333 like this.
  39. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    Indeed, this is a new issue and happens only to new projects, so even if have worked in unity for years does not mean will come across it easilly

    I work 50+ projects at once thus have to fast create many new to test things, that is probably why i have got this 3 times

    To clarify unity does not destroy projects at random, happens only in brand new started projects and only in unity 2020 and above. So far have seen happen only once also per project, if projects passes 1st reload is never happening again
     
    Zarkow and blackfritz like this.
  40. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363


    Btw, when i got the issue, i recall i saw a reimport of things like what happens when first create the project, so my guess is that:

    1. Unity creates a new project though the hub
    2. Sets a flag to do the template import on first load and then this flag should be reset so that import not happen again
    3. Project loads BUT the flag of clean object generation is not reset for whatever reason, this is where Unity developers input is important, so we can understand the issue
    4. On project exit and reload and since the flag is still there, the project re-imports the template, apparently before template reimport there must be some check if the Assets has anything and a wipe out action if it does.

    So is rather obvious that the template insertion action is happening again and obvious that there should be a way for any project to tell when this action has already happened. A Unity developer that knows this system could solve this a a few minutes, the problem is to find this developer :)

    This should be a really simple thing to resolve if someone actually cares for it.

    The Swap chain issue on the other hand is exponentially more severe and harder to resolve and some new bug in graphics Unity introduced in 2020 and above, so this one is a show stopper far more and need resolve the soonest as well. This bug renders the engine completely unreliable and is the no1 thing to resolve imo by miles.
    Imagine making a game and all is fine (like i have never seen a crash on my 1050GTX GPU) and suddenly realize all 20xx and 30xx Nvidia GPU crash your game without any way to resolve it or handle it.
    This is a true material of nightmares.

    https://forum.unity.com/threads/con...swapchain-due-to-device-removed.987834/page-4
    https://forum.unity.com/threads/failed-to-present-d3d11-swapchain.1346855/
    https://www.reddit.com/r/unity/comments/xhipnn/unity_keeps_on_crashing_failed_to_present_d3d11/
    https://stackoverflow.com/questions...t-d3d11-swapchain-due-to-device-reset-removed
    https://www.reddit.com/r/gamedev/comments/vmi1gn/unity_crashing_need_help_details_in_the_comments/
    https://www.reddit.com/r/Unity3D/comments/libef8/unity_crashes_when_maximizing_the_shader_graph/
    https://issuetracker.unity3d.com/is...ycount-on-dx11-with-intel-integrated-graphics
    https://canopy.procedural-worlds.com/forums/topic/114-d3d11-swapchain-error-fix/
    https://unity928.rssing.com/chan-30531769/article975366.html
    https://github.com/Unity-Technologies/BoatAttack/issues/172
     
    Last edited: Dec 29, 2022
    AldeRoberge, blackfritz and Zarkow like this.
  41. oltsu

    oltsu

    Joined:
    Jan 1, 2016
    Posts:
    1
    Just had this happen to me as well, 2022.1.19
    Was prototyping for a day, hadn't yet set up vc, had a GPU crash, opened unity hub, the project and poof. Reverted to a blank state with all my assets, scripts etc. gone

    Actually in disbelief that something like this can exist as a bug. What the actual...
     
    Last edited: Jan 7, 2023
    AldeRoberge, Zarkow and nasos_333 like this.
  42. Barnimsson

    Barnimsson

    Joined:
    Nov 22, 2020
    Posts:
    7
    Happened to me now. Unity 2021.3.8f1, Unity Hub 3.4.1
    Yesterday created a new empty 3D URP project and installed Microsplat Bundle. Played around with assets demo scenes for a couple of hours. I closed Unity. After re-opening the project it was as empty as Unity Hub created it for me = empty URP project.
    I'm terrified.
     
  43. Leroy_vV

    Leroy_vV

    Joined:
    May 12, 2018
    Posts:
    2
    Adding another voice to the choir, this just happened to me as well. Unity Hub 3.4.1, Unity 2021.3.15f1 on MacOS Ventura 13.1. My inspector locked up so I closed the editor and launched it again through Unity Hub. The whole project was reset to a blank slate, and all my assets gone.
    Used Unity heavily since 2017 and this is the first time I've heard of this issue let alone experienced it.
     
  44. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    What was the actual filepath of your project before it went missing?
     
  45. Leroy_vV

    Leroy_vV

    Joined:
    May 12, 2018
    Posts:
    2
    /Users/<username>/Rooms
     
  46. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    Just happened to me now a 4rth time !

    Started a new URP project, moved the template folders in a "erase" folder and exited. When back in Unity took forever to go in and redid all template and libraries import again, wiping everything and replace with the template again.

    I post two photos of what i got when i tried re-enter the project, which action wiped everything out.

    I had also changed to Linear color space, so this was also reset.

    Unity seems to do a complete reset, wiping completely everything. This is beyond crazy stuff really. There is a wipe out function in there, and is so final that the data cant be recovered in any easy way.

    Maybe is on the disk and with some voodoo program that can find wiped out items could recover them, but this is a bit far from ideal to loose weeks of work doing that.
     

    Attached Files:

    Angurvadal and Zarkow like this.
  47. CreatureUnknown

    CreatureUnknown

    Joined:
    May 6, 2017
    Posts:
    2
    Another voice in the choir; total reset back to new project template without any trace of any of the files.

    I looked around on the issue tracker and couldn't find anything related to this, but I could have not been using the right terms to find an issue.

    It looks like the Hub was unaware that the project already existed and instead called 'cloneFromTemplate' upon selecting the project from the list.

    Had heard of some similar issues with newer versions of Hub and so I've been on version 2.4.3 for a while, but looks as though the newer version also has the same issues anyways.
     

    Attached Files:

    Zarkow and chemicalcrux like this.
  48. joeface71

    joeface71

    Joined:
    Aug 30, 2020
    Posts:
    2
    Has wipe three projects in a row for me. First one was 2 days of work. Next two were quick test projects. All wiped clean after closing and restarting using hub.
     
    AldeRoberge and Zarkow like this.
  49. ChippingIn

    ChippingIn

    Joined:
    Sep 8, 2022
    Posts:
    3
    Have to sing along. I just lost an entire project -- every single one of its files -- by simply [gracefully] saving and closing the unity editor, then reopening the [now empty] project from the Unity hub. Source control aside, I'm many years into this software dev thing and never saw anything like it. I would love any info anyone has.
     
    AldeRoberge and Zarkow like this.
  50. goodiesohhi

    goodiesohhi

    Joined:
    Oct 12, 2016
    Posts:
    23
    This literally just happened to me. Created a project just today, worked on it for an entire day. Opened it again an hour ago, was reverted back to the initial state, file recovery software could not recover it, some of the files came up but the data was 00 00 00 00 ...