Search Unity

Unity deleted my scene, there is a way to get it back?

Discussion in 'Editor & General Support' started by vegenarie, Apr 30, 2014.

Thread Status:
Not open for further replies.
  1. vegenarie

    vegenarie

    Joined:
    Jan 5, 2011
    Posts:
    287
    When i stopped game using Unity version 4.3.4 it crashed and showed me the bug window, when i loaded Unity again scene was empty and the scene file .unity was deleted, i searched in windows Vista for any .unity file but it was not there.
    I didnt make a whole backup of the project and i didnt backup the scene file as i didnt think Unity could have this bug so big. There is any way to get it back or i have to make the game again?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You always need to back up your project (and all data you care about); it's not optional. Even if Unity was 100% bug-free, it's not hard to lose it through other means—hard drive failure, etc. There's no way to get the scene back now. If you hadn't opened Unity again, you could have recovered it since scenes are saved to a temporary file every time you enter play mode, but that file is removed when you re-load Unity.

    --Eric
     
  3. vegenarie

    vegenarie

    Joined:
    Jan 5, 2011
    Posts:
    287
    What about history files in windows vista?, i readed something like that but never used it.
     
  4. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    No, really, it's gone.
     
  5. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    If it was saved to the hard drive, it probably isn't gone yet. It's just that data recovery is more likely to take more work than redoing a scene. At least its just a scene and not the entire project.
     
  6. yoyo

    yoyo

    Joined:
    Apr 16, 2010
    Posts:
    112
    No solution here, but same problem -- a few people on our team have had Unity crash and delete the open scene file in the process. We're using version control, so we revert and resume, but it's pretty concerning that the scene files are getting deleted in the first place. We're on Unity 4.5.4.

    Anyone else seeing this? Any ideas on the cause or possible workarounds?
     
  7. OpticalOverride

    OpticalOverride

    Joined:
    Jan 13, 2013
    Posts:
    161
    Just had this happen today for the first time (been using Unity for years), also on 4.5.4f1.

    Yesterday I was doing some coding for the editor itself (a couple MenuItem's that do some baking processes for my custom pathfinding), started seeing the error "Failed to save scene" every now and again while working on these scripts, never seen it before. Today, I load up Unity and the scene file is completely gone from the project, I'm thinking the two are linked. yoyo, did you happen to get any strange failed to save scene errors before it happened? What were you doing before it deleted them?
     
  8. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Learn to use source control.
     
  9. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    +1 but I do agree that its a bit concerning that the files themselves are being deleted. Not sure what the purpose of that would be.
     
  10. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    I've been using Unity on a full-time basis for the past 4 years and I've never had a scene delete itself.
    Sounds more like an OS/user issue.

    I've had a scene corrupt itself though, but source control took care of that.
     
  11. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    I've never had one delete itself either. Only ever lost scenes when the editor crashed and I hadn't ever saved them first. Doesn't mean it hasn't happened though.
     
  12. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Those having scene deletion bugs, file reports.
     
  13. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    My guess is that unity deletes the file and then rewrite them (That i learned from unity ignoring the write lock attribute).
    If unity got a problem on writing the file ... the file is gone.
    It would be kind of nice if unity would create a backup(rename the file) of the old scene file first to prevent the problem.
    If unity then has any problem with writing the new file , just replace the scene with the backup file.
     
  14. OpticalOverride

    OpticalOverride

    Joined:
    Jan 13, 2013
    Posts:
    161
    I do regular backups of my projects, it wasn't a big issue, only lost maybe 10 minutes of work. It was simply concerning that an entire file was deleted from my project without my request. Thought I'd report my particular situation in case anyone else ran into the problem.

    I've been using Unity on and off for about 3 years, recently full-time. Never had a scene delete itself until the other day. Again, if you read my original post, I was getting errors while saving my file the day before this happened. No user issue here, Unity should never delete a file without the user's explicit permission (which I obviously didn't give), it's most certainly either a bug with the OS (I'm on Windows 8.1 so I can absolutely see that as a possibility) or Unity itself (what was 4.5.4f1). I just updated moments ago to the new 4.5.5f1, we'll see how that goes!

    I like the solution you give, my guess is it happens so infrequently they simply haven't gotten around to it although it seems at first glance like a relatively sleek and simple to implement solution. I personally already do backups every day, but now with this bug I'll be sure to do a couple. Your solution would certainly be a nice time saver in situations like this.
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I really appreciate the warning. I've been using Unity for 5 years and have never run into this, but I don't for a second believe it's not possible. It sounds like it may a new issue. I'm also good at backups, but I would be quite upset if I even lost a day's worth of work due to something like this. Most programs work on a temp version of the open file and only replace it on save. It's kind of unnerving knowing Unity doesn't do this and having the scene deleted on a crash that didn't happen during a save is even a possibility.
     
    Ony likes this.
  16. OpticalOverride

    OpticalOverride

    Joined:
    Jan 13, 2013
    Posts:
    161
    As Eric5h5 says:
    It was giving me errors stating Unity had "Failed to save the scene", however I could re-save the scene and it would seemingly save. It wasn't until I shutdown Unity/my computer and reloaded it the next day that I noticed my scene was entirely gone from the project and my hard drive (or at least the OS' information pointing to the location of my scene file).

    Maybe when I saved, and it gave the error, what I was seeing in the editor was a temporary version of the scene when really the scene had already been erased...? Then upon reload, as Eric5h5 says, the temp file was erased which alerted me to the fact that the scene file was no longer in my computer. This would mean it's likely that the scene "failing to save" (for whatever reason, see my description of the type of code I was writing in previous post) may have in turn deleted my scene, or corrupted the file.

    Not sure, anyway moral of the story is: This can happen, be sure to backup your projects! Although you should already be doing backups... so I guess the new moral of the story is: Here's another reason to backup your projects!
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I didn't catch that yours happened on saving the scene. The scene you were working in was probably just loaded into memory even after the .unity file was gone. So in your case, that makes sense. File was corrupted on save, editor didn't crash, you kept working. But the OP never mentioned that situation, so it can't be ruled out that it could happen with just any editor crash.

    As for temp files, it may be saved to a temp file when Play is pressed, but the editor could certainly crash without you ever pressing play and generating a backup temp file during that session. What I was referring to when I said most programs would work on a temp version of the file would be something like MS Office does. There's an extra file in the working folder that starts with ~ that is the current working file. When you save, it first writes to that temp file, then it overwrites the main file if all went well. Maya does something similar. I believe it stores its temp files in the user temp folder. When you save, if it crashes or has a save error, it doesn't go ahead and overwrite the original file. Instead it will tell you the location of the temp file before the crash so you can go decide whether to try to recover it.
     
  18. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,699
    Unity deleted my scenes twice. Once when I was a week out of finishing a major project. My last back up was was a few days before that. So not that bad. But bad enough.

    As such, I back up each day but also, prefab each scene.
     
  19. yoyo

    yoyo

    Joined:
    Apr 16, 2010
    Posts:
    112
    We've just come up with a new theory -- we suspect the virus scanner is interfering with Unity during a crash as it is attempting to close files. We are now excluding our Unity project folder from being scanned by the virus scanner and so far no more mysteriously deleted scene files. Knock on wood. (This on Windows 7, 64-bit.)
     
  20. mogwhy

    mogwhy

    Joined:
    Nov 20, 2014
    Posts:
    36
    same here. unity 4.6 just killed my project. lost the work of a day. as the other guy said.
    don't delete and resave.-> move, save, if ok delete. wtf
     
  21. Ricks

    Ricks

    Joined:
    Jun 17, 2010
    Posts:
    650
  22. Mikeedee

    Mikeedee

    Joined:
    Jan 5, 2015
    Posts:
    42
    This just happened to me. Thankfully I backup often, but the last one happens to be 3 days old, so that's 3 days of work gone down the S***ter. The project has over 10gb of data, so you can imagine backing this up correctly isn't as simple as uploading a couple of 5kb scripts to a server.

    Moreover, I think it's absolutely ridiculous to pin all the blame on the developers and telling them "you should backup your data" when this bug should never be here in the first place and regardless of how frequently you backup you always end up losing hours, days or weeks of work which can be beyond frustrating, specially when you are on a tight deadline which is the case of 95% of the devs I know.
    That's the exact equivalent of telling a player who's complaining about losing a big chunk of progress because of a crash "games have bugs, it's your fault if you didn't quicksave every minute you twat".
     
  23. OpticalOverride

    OpticalOverride

    Joined:
    Jan 13, 2013
    Posts:
    161
    I know your frustration. But software, especially large/comlex software like Unity, will always have bugs. Sometimes it's not necessarily up to Unity, but perhaps in the way any given OS is dealing with saving/moving data mixed with various other desicions/necessities/constraints. People, computers, and life aren't perfect, the only thing you can do is do your best to protect yourself from them.

    I mean, you purchased a $1,500 program that is allowing you to do the work it took whole companies to accomplish just 5-10 years ago, IMO go easy and give it some time and a break.
     
  24. spooneystone

    spooneystone

    Joined:
    Feb 1, 2015
    Posts:
    13
    If anyone has this issue still, I just saved it all by simply looking in my recycle bin and restoring it.
     
  25. Obaidullah

    Obaidullah

    Joined:
    Apr 29, 2015
    Posts:
    1
    I am using unity 5.1 I was doing designing with terrian and found that my entire scene folder is deleted. My unity didnt crashed or something. I lost my all work. I was giving final touch to my network based game. I have searched in recycle bin but no use. I am very angry with unity.

    Have anyone got solution to that.
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If you don't have a backup, take it as a lesson. Your hard drive can fail at any time for many reasons, so whether Unity is at fault or not isn't all that relevant. Always have backups of anything you care about.

    --Eric
     
  27. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    Even if I have source control and backups, it would suck to lose the work I did since the last commit. Or maybe it's a tester project that's not in source control - not the end of the world if it disappears but still annoying if Unity wrecks the project. Perhaps Unity could investigate the possible ways that this might be happening, even if they can't reliably reproduce it.
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Of course, but having some kind of backup is computer usage 101, and there should never be anyone who loses an entire project, whether it's due to a bug in Unity or something else.

    --Eric
     
    hippocoder likes this.
  29. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's not just Unity. It's the nature of using a computer that's inherently unreliable. It's unreliable because it's not possible to create anything perfect, only an approximation for a reasonable price. With that in mind, one must service the car, clean the yard and back up work.
     
  30. NitroZoron

    NitroZoron

    Joined:
    Jun 29, 2020
    Posts:
    42
    If your Unity engine crashes and you accidentally reopen your scene you pretty much deleted your progress or even the scene itself. However you can get it back

    just follow these steps (I had to find it out myself & now my hand/finger hurt):

    try going in the recycle bin tool on your computer then try finding your scene there. Next right Click On your scene and click "Restore". You should end up having your scene in your asset again.


    Welcome
     
    eleniadrian2007 likes this.
Thread Status:
Not open for further replies.