Search Unity

Unity deleted my entire project

Discussion in 'Editor & General Support' started by MrDude, Jan 6, 2016.

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

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Now I have been telling Unity about this for years and every time some smart allec from the forum tries to tell me "Just hit Edit->SaveProject" like that will magically solve everything well I am here today to report this issue AGAIN in the hopes that someone at Unity will FINALLY take notice of this bug...

    If you use Unity for however long and then it crashes, it automatically reverts your project back to the way it was when you first started up Unity. That means that no matter what changes you made to your scene, they are lost. Any changes you made to prefabs, they are gone. Even new prefabs that you created are now nothing more than a filename with no content.

    Saving frequently helps nothing. the only way to prevent Unity from destroying your work if it crashes is by closing unity and re-opening it so it will at least save what you have done up till then. This means my daily workflow consists of closing and reopening Unity about 20 to 50 times depending on how many hours I work that day...

    But... right now I am working on a project for a client and we are using git to sync the projects. THIS led to a whole new level of bad since Unity seems to store the repository also and reverts to that also. Before all I had to do was modify my scenes again and recreate my new prefabs and fix the old ones... now Unity actually goes and deletes entire scripts that I created and changes code I wrote back to what it was before... Let me repeat that... Unity deletes my scripts and alters my code!!!

    I spent about 2 hours modifying 2 script and 5 hours getting the system to work like it should. When it was done I moved onto something else and forgot to increment X inside my while loop and boom, an infinite loop and I was forced to quit Unity. When I restarted my new scripts were gone and all my code changes were undone also! I mentioned this to a friend of mine who simply refused to believe that Unity changes your code...

    Well, last week it went one step worse... Yeah, that's right. It gets worse.

    I tried to pull the repo onto my Windows laptop but of course it would just hang for an hour and then tell me "Sorry, please try again later" so I zipped up the project and sent it to the laptop via wifi. All I had for my efforts of trying to pull the repo down was the .git folder. i figured I would copy the files over to the folder then do another pull just so it can see the files are all here...

    I opened Unity, and for 10 minutes all was well. I never got a chance to pull the repo again as Unity froze on me again when I double clicked a script. For some reason MonoDevelop hanged after it opened the file and because MonoDevelop never resumed, Unity was unresponsive also. So I force closed both and restarted Unity... only to find that every single last file and folder in my entire project has been deleted. Let me just repeat that: EVERY SINGLE FILE AND EVERY SINGLE FOLDER was gone... Assets, Project settings... everything...

    Now I dare someone to tell me that if I his Edit->SaveProject that will protect my work when Unity deletes absolutely everything.

    Now I ask Unity to once again tell me that this is expected behavior and justify how force quitting Unity deletes my work, changes my code or deletes every single file I have in the project.

    I was not a very happy camper that day. If my program crashes I expect it to open afterwards... not to f*ck with my work first and undo all the hours of work I did. I've been complaining about this for years now and still this remains... apparently it is how unity is supposed to work. "Intended behavior" I believe they called it last time...

    Well I think it is high time that this intended behavior comes to an end!
     
    Last edited: Jan 6, 2016
    Tymac, CloudyVR, kevdome3000 and 2 others like this.
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    This sound as if something is not correctly setup.
     
  3. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    This sounds like something at the OS/filesystem level.

    Seriously, this really sounds like it's got nothing to do with Unity and everything to do with your OS/filesystem/hardware..

    Do you have some Volume Shadow Copy Service (VSS) running on your machine? (something doing a backup?) sounds like something is reverting your filesystem.

    It's possible (read 'likely') that the cause of the 'reverting of files' is also the CAUSE of Unity crashing.

    Consider this. You've saved your work, at this moment Unity modifies the disk. What's the chances of item 1 being more likely than item 2?

    1. Unity crashes and has kept a record of all modifications you've made. At the time of crash, it still executes long enough to revert all these files. Not only that, it also knows about the .git directory (magically?) and its content and reverts this stuff too?

    2. Something reverts some parts of the filesystem (VSS, or somthing does something whacky). This causes Unity to crash.

    Slashing this somewhat with an Occam's razor certainly points to (2) IMO.

    Also considering that you've had this happen more than once, yet I've never heard of such a thing happening to anyone else.

    Have other users reported the same problem? If not, then again it's likely something in your environment and not Unity. I say this as you claim it's not a new issue, and therefore with millions of users, you'd hear more complaints.

    Edit: Note, I too have been using Unity for years and suffered through a gazillion crashes but never ever has it had any effect like you suffer. I too use git.
     
    Last edited: Jan 6, 2016
  4. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    279
    Well OP I agree with you that unity should be better at handling recovery from crashes so you have my vote there.

    The funny thing is that unity even has those temp files of the scene before the crash, but instead of asking next time you start the editor if you want to recover said files, what it does is simply delete and ignore the previous last file, if you want to not lose work you have to manually search and restore them before starting unity again...

    Regarding your problem though, I also use unity with git, and never once I saw unity lose script changes, the only thing it loses as far as I'm aware are unsaved scenes and maybe modified prefabs.

    I believe your problem with scripts is more tied to git, that I discovered is horrible, than to unity, since by personal experience I have seen git revert my stuff more than once.

    And you're also using MonoDevelop, I think it's such an horrible software that I stopped using it long ago, I'd rather use notepad++ than MD, an IDE that crashes simply by opening an project, and leaves the crash message behind the splash screen, is not trustworthy IMO. I wouldn't be surprised if your problem lies somewhere there too.
     
  5. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    I think that's unlikely. git is one very battle hardened piece of software. Such a failing would make it an absolute liability. This is just not the case.
     
    zombiegorilla, Ostwind and Dantus like this.
  6. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    279
    Maybe it's not a git problem but a smartgit issue. But I'm 100% sure it reverted and lost my code, as I have seen it happen 3 times in a day with 2 other devs by my side looking at it and seeing the issue, using smartgit with github.

    It would show the diff on both files, I'd merge everything properly then push it to the server, pulling the code just after it and an incomplete file would come.

    I've never seen anything similar when using SVN.

    edit: After that I constantly backup my files on a different folder...
     
  7. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    Have you posted about this before? I seem to remember another thread or post within a thread with a similar problem.
     
  8. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    @ Aurore
    Honestly, I don't recall if i posted here or when or under what heading. I've sent PMs and bug reports etc

    @larku
    I have never even heard of a Volume Shadow Copy Service before your post so I think it unlikely that I have one :p

    Something to keep in mind is that I have had this crash bug for years now and never before has it touched my code. I knew all my scene changes and prefabs would be lost or destroyed, that much was agiven, but my code would always be left in tact, even on the very prefabs that had their changes reverted...

    This is the first time that I am using GIT with Unity (via SourceTree,by the way,on OSX) and this thing where it modified and deleted my code has only ever happened once on this system and that was with this project. The thing where all my files were deleted when unity crashed, this was in Windows, though, a brand new system I just got and only just finished installing Win10 on. Hell, unity is the only thing I had on there before I installed SourceTree to pull the repo.

    In both cases, the one thing both had in common was git. And like Rafael said, "unity even has those temp files of the scene before the crash, but instead of asking next time you start the editor if you want to recover said files, what it does is simply delete and ignore the previous last file" that, to me sounds like exactly what I've been saying except Unity keep track of the .git folder also. When Unity crashed it simply said "okay, delete all temp files and restore the originals and with that it automatically did a revert of my project to the last commit I made...boom, all the work done since simply removed because git is now using a version of the project that didn't have those files or changes in

    There is nothing magic about Unity knowing what files there are in the folder when it starts.Recall what I said about the windows git repo... I tried to pull it but I got nothing pulled so the .git folder listed no files in my project. If Unity then went and stored that info and when crashed triggered git to revert to the state where I had no files in the repo history... that would explain it perfectly.

    Git deleted all my files, not Unity, because Unity tracked the git folder and triggered git to revert to when I had nothing. Rafael said you could get your last changes back by manually searching for it and replacing your files (I have not tried that, btw, thanks for the tip)... I agree that Unity should not simply delete stuff and revert to the state of Unity's last known successful startup. It should leave our stuff alone and just start, continuing where it left off.

    I think the answer I got last time was that if they restore to the files as they were you would likely restore back into whatever caused Unity to crash and thus your project is then completely lost and you can't startUnity again because it will continue to fail... to that I say "Hello, hold down the Alt button when you start Unity and Unity will work again". True the other project MIGHT case an infinite boot/crash/repeat cycle but then at least we will have the option of deleting the temp folder and decide for ourselves what we are willing to loose or at LEAST I could have made copies of the two scripts I had modified and not simply loose it with no say in the matter...

    All I want is a simple popup that appears after a crash and ave that popup ask me: "If you continue using the previous project as is, it might cause Unity to crash again. Do you want to Continue using the current version or reset to the last stable version of your project?". Two buttons. One deletes all changes made since starting Unity, the other says "I will take my chances, thank you very much".

    Hell, MonoDevelop hangs and because that piece of crap hangs and unity is waiting for it to open the file so it can scroll to the correct line, Unity is now unresponsive also... So MonoDevelop hangs and as a result Unity causes me to loose all my new prefabs and changes to existing prefabs (at best) or (if using git) possibly deletes my new scripts and reverts my code or (at worst) triggers the deletion of everything...

    Just give me the option of loading my project as it was before. There is no reason for Unity to delete all my prefabs or anything else just because MonoDevelop hanged... saying that "hey, if we crashed, something must be wrong in your project so we are doing you a favor". Nothing was wrong... the only thing that was wrong was me deciding to use MonoDevelop as my editor. Noting more. And now my work is lost....

    See why I am unhappy about this state of affairs?
     
  9. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Your arguments are sound and you seem to speak from a view point of reason so I will attempt to just add a few footnotes to what you are saying just to hear your take on matters then...
    True, except it happened on a 4 year old iMac and a 2 day old virgin system with only Windows 10 and Unity installed. So which OS/filesystem/hardware would be to blame?

    I am running SourceTree to make my project backup via git, no other backup software is running. Not even TimeMachine (though it is sounding more and more like a good idea to start it)

    Unlikely as 90% of my crashes stem from my own forgetfulness. If I have a scene running that makes use of UnityUI, then change code in MonoDevelop and return to Unity, I have around 1 second to click the play button to stop the scene or the code will start to compile and Unity is 100% guaranteed to crash. 90% of all my crashes is because I didn't stop the scene before making code changes. By that statement of yours it would mean that Unity compiling my code while a scene is playing is the cause of unity crashing and my work being reverted... If that statement were true then Unity is 100% to blame... and I am assuming your intent with that statement was to shy blame away from Unity so let's go with no, it's not likely...

    Allow me to counter your list with another one and you tell me which one sounds more likely...

    1. Unity starts and keeps a copy of every meta file it finds during startup. When Unity crashes, during RESTART it detects the crash and replaces what it considers broken files with the last known working files it had during STARTUP.
    2. My Mac has a virus that targets Unity and randomly copies files and deletes others then causes Unity to crash and when Unity restarts the virus replaces the files in my project with the ones it randomly selected to save

    Care to revisit that statement? :p

    Now THAT is an excellent point! If I were a charlatan then you would have me dead to rights right there... Except in this very thread someone from Unity says they have heard of this before (possibly from me possibly from elsewhere), I have had an email in which I was told this is intended behavior an thus they were not going to publicly announce "Dear people of the world. Please take note that Unity does what it's supposed to. thank you for your time. Have a nice day"... and finally, consider my dear friend and fellow Unity programmer... when I told him what happened to me, he simply said I was wrong. I was mistaken. Because it was the first time he heard of it, it must be impossible. So let me ask you this... how many people so far might have been" the first to hear about this" and just dismissed it simply due to it not already being a well talked about issue?

    I would be more than happy to accept that as an answer if that is the case. However, both Windows and Mac? 2 Mac systems, 8 years of Unity versions and OS updates? On a brand new laptop, 2 days old, nothing on it except the OS and Unity? On Windows, unlikely. On Mac, too many variables over too long a time... The only constant has always been Unity and MonoDevelop. "while" loops and Unity UI are the main causes for my crashes... most of he time it is an unresponsive Unity causing me to force quit it and make me, myself, the cause for the "crash"

    As for people who know about this, yes, I have heard of people who said this happened to them before. Raphael being one of them, for example. I am not the only person this has happened to...

    Now, having said that... git was never a factor in my crashes and losses and reverted code and missing files have never been a factor in it either. Now I add git and suddenly I have these issues... It does not take a rocket scientist ti figure out that git has something to do with it... Or to be more accurate, those who say git is rock solid, I will grant you that... but SourceTree... that might have something to do with it...

    But here is the question... why does SourceTree only cause a problem when Unity crashes for the same reasons that it used to crash before? I make a change, SourceTree notices and asks me to push my changes... Suddenly, after a Unity crash,my files are missing... Should I blame:

    1. The app that I know reverts my prefabs and destroys my new prefab data (leaving only an empty file) after a crash
    2. The app that scans for changes and ASKS me to store the changes...
     
  10. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    If you have actual questions about how to set it up and what might have gone wrong, ask here in the forum. You will very likely get some useful help because a lot of people here are successfully using Unity in combination with git.
     
  11. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    VSS comes with windows and is part of the OS and is used by backup programs, databases, and lots of other software, but since you're on OSX that's not causing the issue.


    Which makes perfect sense. The scripts are edited in an external application (MonoDevelop) and are saved to disk there. The changes made in Unity (prefabs, scenes, etc) are still only held in memory (and maybe some temporary files) until you save them in Unity..

    If a crash happened at this time I'd expect to keep my saved work (the scripts) and lose my unsaved work (prefabs, scenes, etc).

    You use git yeah? The I see no reason to not continuously hit ctrl-s (option-s) every few moments if you're scared of losing work (I do this by habit, and cant stop doing it now). If you need to revert an unwanted save, that's what git is for. Yes add me to the 'smart allec' list, I'm not being a smart allec here, it is IMO the solution to the problem of losing unsaved scene/prefab edits. It puts you in control of what's saved and what's not. So you really want lots of unsaved edits?

    So in this scenario I see only behaviour that is 'as designed' (as Unity already stated). So this actual issue is expected behaviour.


    So ignoring the 'as designed' lost scene/prefabs files above, the actual missing files issue (stuff that was saved) happened on Windows? If so, then it could have been something related to stuff like VSS.

    Pointing the finger at git here is a total red herring. git is battle hardened software. I've used it for years on multi people teams (20+ people) across Windows, Linux & OSX. I use it on all my Windows, Linux and OSX machines every day. Never, ever, not even once have I experienced git 'losing' or 'spuriously reverting' files.

    Remember, it's job is 100% to track and maintain these files. The dev world would be exploding with rage if git did such things.

    So other than user error, I have no confidence that git is in any way to blame.

    We're confusing two distinct issues here again.

    In this context, the temporary files you mention are for the unsaved edits (saved edits reside in the file proper, not the temp files).

    Unsaved edits are lost in a crash 'by design' (which you dislike). I'd be assuming that there are some good reasons for not recovering temp files from a crash. I can hypothesise a few.


    No, that's not how temp files work.

    When Unity crashed: it crashed and exited.

    When Unity next started: it loaded the last known saved state (the real Assets in the Assets folder) that was present on the filesystem.

    Unity does not know about your git install, it does not invoke commands to revert your code. That just doesn't make any sense. You're a programmer, think about the amount of explicit work required for Unity to revert your git code. look for a repo (.git folder), run some git commands to learn about the repo, then invoke a git command to revert git reset --hard).. What about newly created files? Were they deleted too? If so, this will require a git clean -f ...

    I just don't see Unity doing anything like this.

    Again, this appears more like a filesystem issue and not a logic issue. Have you checked you system to see if VSS is running? It's not something you'd typically start explicitly, it's a service used by other software. I'm referring to the Windows machine here since that's where the real disappearing files issue exists.


    As above, I don't believe this explains it at all.. Unity doesn't 'revert' files after crashing. It only ignores unsaved edits (temporary files). Unity doesn't 'do git'... If it's happening I'd assume it's happening at the file level and not explicit knowledge of git.

    As above, do you really think that Unity is issuing git reverts during a crash? Seriously? I use git and unity every day, if it did this I'd be swinging my fists.. Ask Unity that one specific question "Does unity issue any commands to any git repositories during a crash".

    Sounds fair. An option to recover can't be a bad thing - for recover of important lost work. But I do see that Unity might see this as a mind field to allow such default behaviour as it may exponentially increase the number of users now working with corrupt assets causing Unity to be more unstable and creating more issues than it saved (imagine all the new forum posts about Unity corrupting files etc if Unity made this an easy route).

    I see why you're unhappy and it'd annoy the *&% out of me too. But I think you're pointing the finger at the wrong cause.

    The symptoms of the problem is Unity crashing and files being reverted. The cause of the issue IMO is not yet discovered.

    You've concluded that Unity is the cause and are now speculating on how Unity is causing it.
     
  12. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Git failing, if it ever happens, is most likely to happen on Windows (they say it's the least supported since it's not Unix-like, yet it does a pretty great job anyway). SourceTree has never disappointed me either. Time Machine is basically required, so do enable that :)

    Just to rule out file system corruption: Reboot the Mac and hold down cmd-S to start in single-user mode. Run the command "fsck -fy". No errors, no worries. Any errors? If fixed and a second run doesn't show any new errors, grab the latest OS X combo updater and apply it to ensure there aren't any broken system files. I've fixed a lot of Macs with just that procedure.

    Also have a look in the Console app. App logs or the system log might indicate some problem you didn't know about. Is something gathering up crash logs like Pokémon? Could be the culprit if it's a system service.
     
  13. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    I'm only considering the 'spurious reverting of files' as an issue. The lost unsaved edits are by design and I'm not that interested in the rights/wrongs of that while isolating the unexpected behaviour.

    So I'm pointing my finger at Windows again (which does in fact have have VSS and the ability to have filesystem snapshots and reverts, etc) which could explain the reverting of a tree of files/folders or entire filesystem.

    How often are the files reverted? In these cases was it your own cause? Did you hard reset the machine?

    Again, I want to ignore any unsaved edit losses here and only consider the crashes where files were reverted.
    Let's find out, ask Unity - "does Unity keep a copy of every meta file it finds during startup, When Unity crashes, during RESTART it detects the crash and replaces what it considers broken files with the last known working files it had during STARTUP"

    I'm pretty sure the answer to that will be no.. But I'm just guessing.

    In fact why don't you test it yourself.

    After every unity crash do a git status to see the status of your assets and meta files. Then start Unity, let it do its thing, then do another git status and compare the results.

    I'm pretty sure that Intended behaviour statement was aimed at "Ignoring unsaved edits after a crash" and not at the reverting of files issue. Let's not keep mixing them, they're different things.

    Reverting files? Ha, never... This is the Unity forum.. No such issue would go unspoken.. There'd be millions of posts.

    Again, the reverting of files only happened on Windows yeah?
     
    Last edited: Jan 7, 2016
  14. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    @ larku
    You have the facts but you have them slightly mixed up.... Allow me to clarify:

    1. My code got reverted only once, EVER, and that was on my Mac. It doesn't happen every time unity crashes, omg no... It happened only once and it was in the first project I ever used git with... I've been using Unity since version 1 so yes, I've had loads of crashes both self caused via loops or force quits of Unity (you mentioned above if I hard reset my system, no, just force quit Unity). Anyway, after 8 or 9 years of using Unity and having it crash on me a million times the first and only time it ever reverted my code was in the first project I used git with... Now tell me that would not make you want to point a finger at git! Thing is, I tested the code, I ran the scenes... no possible way I could have done that without saving my work... So it was saved... then next thing I knew all my code changes was gone and my script was as it was hours before... Point is, my code got reverted once and it was on a Mac, not Windows, no.

    2. All mt files getting deleted, THAT happened on the Windows system. No idea if it reverted my code as everything was gone. Oddly enough, when I say "everything was gone", that includes the .git folder also. I unzipped the files into that same folder and have been happily working in there since. So something deleted everything, including the.git folder and it happened after a Unity crash...

    3. I am not saying that Unity is sending git commands to check up or update or restore or whatever. I am not saying that after a crash Unity starts sending git commands to F up my system. I am speculating wether Unity keeps a snapshot of whatever it deems important in the folder the project is in. I.e. the folder that contains the Assets folder and considers git something important also. Is it taking a snapshot of my repo and replacing that file with the snapshot when it restarts? THAT is what I am thinking is happening... As a programmer I can tell you that doing all the works you mentioned would indeed be a lot of effort and not worth it... but then I want to throw it back at you that simply deleting a file and copying another file with the same name into the folder where the old one used to be is NOT a big deal at all... especially if you have a list of files and just looping through...

    4. Most importantly... Your views seem to be coming from a good place except you are making one mistake and basing all your view on that single mistake... hit save every time before I hit play. I hit play every very often. No way in hell my prefabs will work if they have not been saved. I hit save like a mad person... and yet all prefabs I created between Unity starting up and Unity crashing, it's allllll gone. When I created the prefab it created a file on disc. That file still remains. It's just completely empty. If you drag it into your scene all you get is a red colored filename... My SAVED prefab that I used in multiple scenes got deleted. My scenes, no matter how many times I save it, they are reverted. Prefabs that were saved weeks before are not deleted but any changes I made to them in scene and on the prefab itself are all reverted... Hitting Save makes no difference at all. The only way to keep these new prefabs from being deleted or my changes from being reverted is to close Unity. Closing saves my work. Hitting save is as useful as chewing bubble game...

    Nothing that I save is saved if Unity crashed... THAT is what I contacted them about and THAT is what they say is intended behavior. All this stuff about git and my scripts being modified and deleted, this is all new and only in this, this first and only project to use git. So keeping in mind that all saved work (except scripts/graphics that were edited outside of Unity) is lost irrespective of how many times you hit Cmd+S, most of what you posted above becomes null and void as it was based on a flaw in your logic.

    I stand accused of speculating as to the cause and that stands 100% true. I posted here to bring it to Unity's attention yet again and mention that now, whatever is causing these reverts, is worse if used with git. I want THEM to tell me the ACTUAL cause so I can stop speculating.

    One thing I might suggest to them that I think might actually, possibly make a difference... Make cmd+S (or shift+cmd+s or something) call SaveProject, not SaveScene. SaveProject HAS no shortcut so requires manual menu clicking every time I want to use it. One thing that SourceTree has visually shown me and given me 100% confirmation of is that changes to prefabs are saved when you hit SaveProject but not if you hit cmd+S. Same with any changes to .anim clips. They are not saved until you select SaveProject...for which there is no keyboard shortcut. Why not? Just a suggestion towards some level of a fix. Not sure if that will stop the new prefabs from being emptied or not but at least adding a shortcut to a menu option shouldn't be too much to ask as a sign of good faith...

    Everything else... I don't know... I am pointing fingers, distributing blame, speculating away. All I can say with 100% accuracy is that all my woes have aUnity crash at the heart of it wether caused my MonoDevelop, Unity itself, my code or me force quitting unity.

    Hell man, my issue is super easy to replicate, actually... Create a new project. Create a script or do (they don't have to do anything, just exist. Drop them on an empty game object, drag that object into the Project's tab to create a prefab. Hit Cmd+s/Ctrl+s and save your scene then force quit Unity. Restart and notice that your prefab has been nuked. Cmd+s does nothing. The prefab in your scene is empty and so is the prefab itself. No way a person would expect THAT to happen... It's created on disc AND they hit save... and yet...
     
    Last edited: Jan 7, 2016
  15. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    @orb
    Thanks for that. Will give it a go. Can't hurt to play it safe, right?
     
  16. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Hey MrDude,

    I agree, it's walking very duck like, but still - what's causing such behaviour? It's unlikely a 'git' thing, it's also unlikely an explicit action of Unity.

    Code must be saved, but scenes not. You can run unsaved but modified scenes. But I think your point is about the code so .... moot point.

    Ok, so a different possible causes. But my reasoning for why I don't believe it's Unity or git 'causing' the reverting of saved files still applies (unless Unity can clarify if it does in fact sometimes take that explicit action). It doesn't sound like the type of thing that can happen by accident.

    Cool, got it.

    If Unity did such things then that could explain it. But that still doesn't sound the the type of action Unity would take - as I'm sure you'd agree, it's a pretty insane thing to do. I'm sure the Unity engineers would think likewise.

    Absolutely, I only have an interest in finding out what is the cause :) It's an interesting puzzle.

    That is totally nuts then. I'd like to see Unity publicly state this is in fact how Unity works (I've never seen or heard of any such crazy behaviour). I can't see a rational reason why Unity would intentionally choose this behaviour.

    Especially since your .git folder is at the same level as your assets folder - why would Unity start tinkering with files outside of the Assets folder (or it's own folders)? [rhetorical question] It sort of defies logic.

    It is this very fact that make me strongly doubt Unity is at fault. git files, .cs files, etc are all saved outside of Unity, hence any crash of Unity would make it IMO very unlikely to have an effect on the .cs files.

    You'd assume that any .CS files that Unity has open would be open read-only as it never needs to write to them - so I'm going to discount any lost (open-for-write) file handles during the crash.

    Ok, I just tried this on OSX and had no issue at all. [edit, I did it twice just to be sure]

    What I did:

    1. Grabbed one of my existing game objects (that as a bunch of scripts with values set) and dragged it into project asset folder - this created the prefab.
    2. I checked the file system and the content of the prefab is as you'd expect, full of text defining the prefab.
    3. I then hit option-s to save. I then dragged the prefab back into the hierarchy of my scene, this created a prefab instance.
    4. Checked file system again, content is still good.
    5. Then I hit option-s again to save the scene.
    6. Checked file system again, content is still good.
    7. using the'Activity Monitor' forced quit Unity.
    8. Checked file system again, content is still good.
    9. Restarted Unity - all still looks good
    10. Checked file system again, content is still good.
    So, I don't see the same behaviour as you here.

    I'm using 4.6.9f1 on OSX - did you have this issue with the 4.x line?
     
    Last edited: Jan 7, 2016
  17. Dave-Carlile

    Dave-Carlile

    Joined:
    Sep 16, 2012
    Posts:
    967
    This is a bit different from MrDude's steps. Try starting with a new project instead of an existing project. And don't ever save the project.

    I'm curious what is actually saved when saving the project itself since everything seems to be tied to a scene. I rarely ever save the project - always just use Ctrl+S - and haven't had problems that I associated with it. I guess I have had the occasional "lost work" when having to kill the Unity process, but I'm fairly certain that has always been a case of forgetting to save the scene before running.
     
  18. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Don't ever save the project? (I didn't save the project during the steps I performed).

    OK, repeated with (on OSX).

    1. Create new project
    2. create cylinder in scene
    3. drag cylinder from hierarchy to assets - creates prefab
    4. check file system - all looks good (prefab has expected content)
    5. press option-s (prompts for new scene name - entered and saved)
    6. check file system - all looks good (prefab has expected content)
    7. drag two more instances of prefab into scene
    8. check file system - all looks good (prefab has expected content)
    9. press option-s (prompts for new scene name - entered and saved)
    10. check file system - all looks good (prefab has expected content)
    11. Force quit unity
    12. check file system - all looks good (prefab has expected content)
    13. Restart Unity
    14. check file system - all looks good (prefab has expected content)
    15. Note: upon opening, Unity has taken me to a NEW EMPTY scene (as it often does)
    16. Opened saved scene
    17. check file system - all looks good (prefab has expected content)
    18. Scene looks fine, all prefab instances are there.
    I never once opened the File menu, so there is no chance I ever saved the project - only ever pressed option-s to save.

    Still seems ok on my setup.
     
  19. Dave-Carlile

    Dave-Carlile

    Joined:
    Sep 16, 2012
    Posts:
    967
    Thanks - just wanted to remove that possibility since "new project" was part of the proposed repro instructions. This is the behavior I would expect as well. As long as the scene itself is saved and the assets are on disk, I can't see Unity losing them or reverting them unless there's something else going on. Still curious what "save project" actually does :)
     
  20. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,657
    There's literally no code in the Editor that does anything like this. I mean, what you're describing would require not just that we keep a copy of the meta files, but that we actually keep a copy of the assets (because that's what it would take to replace your scripts); that's not something that we would do by accident. (Some of the customers we have with 80GB+ projects would have noticed...)

    The only modification that will happen to stuff inside your Assets folder during Editor startup is the generation of .meta files for assets that don't have them. That's it. There should be no other changes to any files in that directory.

    The Library folder is a different story, but it's really just a cache of stuff that we generated from the Assets folder, and can be completely regenerated using Reimport All (or just deleting the Library folder and reopening the project). It should never be added to source control.

    You're not doing something like storing all your projects on an external HDD that you share between the machines, or something like that? I've seen some problems when trying to store Unity projects on disks formatted with the exFAT file system.
     
  21. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    @superpig
    Your first answer, thanks. I've been waiting for a straight answer to that for a while now. So now I can put that to rest at least. Thanks. But unfortunately now I am back to having no viable theories any more...

    Your last question, I have wanted to start doing exactly that but using the NTFS file system. Haven't started yet though. I did it once before but found I had a 3 to 10 second pause every 30 to 60 seconds of using Unity and found that highly annoying so I stopped. About 18 months ago. When I started using Bootcamp I wanted to do that again but never did... (oh, and no, since I got the laptop I haven't used bootcamp either, in case anyone was curious :p) All my data is in /UnityProjects on my main drive

    @larku
    Or course you won't get it to work because now that I have given you step by step instructions karma has decided to make me look like a b*tch again because now my own instructions don't work for me any more either. Guess it only happens when there are many files but when it's easy to prove then it just works... :( Thanks for trying it, though. It's so annoying that I deal with this issue daily but the ONE time that I ask someone to test it, it bloody works as it should :( Arghh! :(

    I suppose this means I have to now modify original statement also to say "Saving is as useless as chewing bubblegum, most of the time". When my clients tell me "That that that happens all the time all over the place, please check because some times it just doesn't" my heart just sinks and my mood just goes down a few notches... having to find a bug that happens "some of the time but not always" are always the most fun to find... not :(
     
  22. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    I haven't got anything useful to say about the problem itself - but consider doing things differently, the way I handle online backup is using source tree and bitbucket, which work great, but besides that point, I NEVER push or pull changes or whatnot from my actual project directory. I use a duplicate folder, and when I'm ready to make changes to/from the repo, I either copy my project folder into that duplicate and push changes, or pull changes into that duplicate, and hand select what I'd like to bring over into my actual project folder.

    I guess nothings 100% safe, but thus far I've never had any problems even close to this kind of stuff.
     
  23. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    @Dave
    I used to use Cmd+s all the time till I realized it did nothing. Then I started using it less but use it still as a form of good measure. Instead of hitting Cmd+s I now hit Cmd+Q and save the scene when prompted. that works perfectly.

    If you have a git repo setup, install SourceTree and start making changes to your project. You will notice that as you change scripts, sourceTree will ask you to commit them. If you modify an animation, though, Source tree will not recognize that change until you either quit Unity or hit SaveProject. Saving the scene does not save the changes you made to the .anim clip that is used in your scene but not part of your scene. It is part of the animationcontroller in your scene but the animationcontroller didn't change so hitting Cmd+s didn't update the animation.

    That is one example for you. Another ons is if you change a value on a prefab or change the prefab entirely. SourceTree will not recognize the change until you hit SaveProject.

    I think I can save myself a lot of lost work if I use SaveProject as often as I use SaveScene. Too bad it doesn't have a keyboard shortcut... that and I now distrust Unity for saving my prefabs so much that I am not prepared to take a chance any more. I'd rather just play it safe and quit and reopen...

    ...and steer clear of git if I can. At this point I am prepared to rotate my hand and point the finger from Unity to SourceTree for the reverted code and missing files. So all I really want from Unity now is a shortcut to SaveProject and an option to restart Unity with... and see, here superpig blew up my train of thought... I thought maybe the temp folder contained all that I have done that I have not saved using SaveProject... but if he says I can delete that folder and have Unity reimport everything and my changes to my .anim files will not be lost then I don't know. If I save my scene every 2 minutes but I save my project once per hour, and unity crashes 59 minutes since my last SaveProject... how can I get my changes back?
     
  24. Dave-Carlile

    Dave-Carlile

    Joined:
    Sep 16, 2012
    Posts:
    967
    Cmd/Ctrl+s should really save everything - shouldn't need a separate key for saving a project vs. scene.
     
  25. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Maybe Unity is crashing because your files are being deleted - Not vice-versa. I'd say the problem sounds very file-system specific.
     
  26. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    The question is never whether you're paranoid - it's whether you're paranoid ENOUGH!

    On the subject of shortcuts: On OS X you can redefine pretty much any menu shortcut for standard apps. ->System Preferences…->Keyboard->Shortcuts->App Shortcuts. Add Unity, make new shortcuts for existing keys you want to use for something else, and bind them to new functions. I doubt I'll ever use "Save Scene as…", so I've put it on ctrl+cmd+S, and "Save Project" on shift+cmd+S. Menu items are written literally, and "…" is the symbol you get by pressing opt+. on a Mac.
     
    MrDude likes this.
  27. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Holy crap that was easy!!!:D
    Thanks orb. I always thought I could only change the shortcuts developers provided to the system as "editable" or something like that. I never played with keyboard shortcut creation before but now that I have.... wow... So darn easy! Thanks a bunch!
     
  28. sowatnow

    sowatnow

    Joined:
    Jun 12, 2014
    Posts:
    309

    Omg what the hell, this just happened to me, I tried to import a new asset, what unity did was to import the new asset, but deleted all my project files. That's 2 months (last back up 2 months ago) of work gone up in the air and I was about to release an alpha. So much for trusting unity. Screw this. And now I can't even load unity, it just gives a black screen. This is a warning to all other users. Back up your project.. I should have done it more frequently.. stuff me.

    Is there a way to get my project back? There is nothing in recycle bin.


    P.S I can't create a new project.

    I am getting the following error:

    Couldn't call method DoTasks because the class JSProxyMgr or method couldn't be found.
     

    Attached Files:

    Last edited: Jan 9, 2016
  29. Pix10

    Pix10

    Joined:
    Jul 21, 2012
    Posts:
    850
    As @superpig points out, Unity doesn't touch your assets. The only time it alters scripts is when refactoring, i.e. when you open a Unity 4.x project or script in Unity 5.x for the first time, and even then it prompts with a confirmation dialog.

    Unity doesn't know about repositories, and has no functionality for interfacing with them - Asset Server being the exception, but even that requires manual control.

    It *is* possible to lose changes when Unity crashes, but this is typically things such as background data and settings that don't save until you quit Unity (and then the only one that comes to mind is screen layout - frustrating but certainly never anything fatal that I've seen). Even prefabs should be safe so long as you've hit Apply at some point.

    On the face of it, it does sound like you have something dodgy going on in your filesystem. I use Sourcetree (and Versions for SVN, and others for other various projects) and while it's possible for new users to become unstuck with it, it's kind of hard to delete files in Sourcetree managed project - if it is a revert you should be able to see this occur in the history log and your Staging area in Sourcetree, but if it's a straight-on delete then when you delete files, you have to commit those changes, so look in the Workspace view and see what's in the Staging area (which could potentially take a *long* time to populate for a large number of files so give it time if it looks like it's hanging).

    Are all your top-level project files missing also? (including i.e. .sln files and Library -- which shouldn't be under version control)? Because if so, then you can rule out .git-related problems.

    If Sourcetree is no longer connected to your project (i.e. the entire project folder contents and repo has also been deleted) then something else entirely is definitely responsible, and yes you may have a really serious filesystem problem, but it sounds so specific (just your Unity project was affected?) I'd find it hard to believe it's not a software problem ...most likely the OS, or something you've got installed that tries to helpfully manage software (something that can quarantine files/folders?), or even malware: Macs get viruses too.

    Is there such a thing as an OS X virus that rewinds Time Machine? A malware creator disturbed enough to make malware that just attacks open Unity projects? Many things are possible no matter how unlikely, but I don't believe you're seeing a problem with Unity itself, unless there has been a major cockup (seem to recall something about the new asset store updater being pulled due to issues with file management) but how that could go unnoticed doesn't bear thinking about...there would be a lot of noise from the get-go.


    I hope you find what's causing it because yeah that would kill my enthusiasm for getting out of bed too. Not a nice intro to 2016.

    edit: typo
     
    Last edited: Jan 9, 2016
  30. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    I mean this sucks, I totally wouldn't be very happy to lose months (or even hours) of work, but goes to show, you really ought to backup like a maniac. Like probably once per day, per project - minimum! Don't suppose either of you guys imaged your hdd recently and have a backup that's a bit old? At least all wouldn't be lost that way...
     
    radiantboy likes this.
  31. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    This just happened to me, unity has wiped 250 gigs of my project - THAT IS EVERYTHING apart form the last asset I grabbed, I downloaded "low poly dudes" it said something about no temp folder, i clicked ok, and I went to bed. I got up and whole project is pink , everything is gone apart from the assets folder apart from "low poly dudes". This is the worst software crash of my life, I have no ghosting tools or whatever running, unity did this itself!! No files in the recycle bin, and my latest back up is 5 days old, sounds new but not if you do 16 hrs+ every day, Im quite literally shaking with fear trying to type this.

    I have run Piriform Recuva, it found a lot of files, I pointed it specficially to my assets dir, it is in the process of recovery now. So if this works I recommend you stop everything, dont use pc, dont touch unity, just run this directly (turn on deep scan and in advance options you need to tick recover file structure too). Im now on my knees praying to Unity gods. This a BAD BAD BAD bug, one of the worst Ive seen in my life. You say Unity cannot delete, but it must be able to, this is no other reason for this.

    I will come back and update this after recovery has finished, I am too afraid to use the pc incase the "lost files" somehow get overwritten by the filesystem, so all I can do is hope pirifom saves my ass. They definitely deserve a purchase if so.
     
  32. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    I don't recall how I came to the conclusion or what the reproducable steps were that led me to that conclusion but I did discover that the fault was in fact with SourceTree and not with Unity. I don't know what the trigger was for whatever happened but it was Source Tree that deleted the files, not Unity.

    Since then I don't use SourceTree unless I absolutely HAVE to and if I DO share projects I make sure to do so daily or a few times a day. Alternatively, like I said, I simply don't use SourceTreet / GitHub but instead I just save regularly. That thing with "As long as you hit save / update then your prefabs are safe" is nonsense. Do NOT believe it. Unity crashes are bad news for your project... but to reduce the risk of loss I have started a rather annoying but required vice. Whenever I have worked on something for a while and whenever I am ready to hit play for the first time after making many code changes, I always hit the shortcut for Save Scene and then use the mouse to get to the Save Project option. This is the important one so it is rather stupid to not have a shortcut to it but there you have it.

    Save the scenes and then also save your project just to play it safe. Also, if you have made a LOT of changes or BIG changes or even just for the sake of playing it safe, close down Unity once or twice a day and then restart it. Closing it down is the best way to protect what you have done. I think closing it down also triggeres the SaveProject to get called and that is what it safeguarding my projects against crashes but after loosing everything I think you will agree with me that nothing it WORTH taking that CHANCE when you can completely avoid the risk altogether by simply closing down Unity and restarting... it takes less than a minute for you to get back to your project and ready to hit play and know that even if you get an infinite loop that forces you to pull the power cord on your PC, your data is still safe... 1 minute for complete peace of mind.

    Don't save and don't cry to others when you pay for your stupidity. Save the scenes and the project every very often and feel like you are secure... Shut down Unity and KNOW you are safe and it only takes you 1 minute a day... or two. Alternatively, make super regular backups to GitHub and if/when it deletes everything DO NOT try to restore things from your end, just pull the repo and start from your last upload.

    Placing a 3rd party app with the ability to delete your files in charge of your project's contents ... shudder at the thought... now factor in that neither Unity or it is equipped to deal with unexpected crashes of the other one...

    Anyway, good luck fetching your stuff back. This happened tome once while working for a client. I lost his entire project along with my new work so I know what you are saying about shaking with fear... What saved my bacon was downloading the project and just redoing that day's work. Yes, I forgot a lot of the changes I made and I re-discovered the missing code over the course of a few days but at least it was just one day's work lost, not the entire year's work...
     
  33. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Thanks for the reply. It has even wiped all of my files in the root of my project, literally wiped the whole game out. I am not running sourcetree or any other program that would mess with my files, so I believe it was actually unity that did this.

    I always save too before a run, but this is something else, no amount of saving would stop this. I should have left a back up going a couple of days ago but I forgot. The undelete has found 99% of the files and I am in the process of copying them back into the folders to see what will happen.

    Scary times, will let you know if I get my project back up. I remember i have been working on a huge building for days so even if I just get that back and make a package then go to back up from 5 days ago, it should hopefully be ok.

    I will definitely put nightly back up in place after this. Usual story I had a great set of back up scripts but they stopped running a few weeks back it seems, and even my crashplan has also stopped working which is for this exact situation.

    I dont even know if unity will recognise this as a project given the S*** it has wiped out even in the root, but hopefully I can stick that in from a back up. Terrible bug, I would kill to know what actually happened.
     
  34. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Undelete not not got back my files from the last week, going back to a back up, Unity just kicked my ass royally. I DO BELIEVE and KNOW that unity can wipe projects now, it seems to happen when you import and asset and it says something about permissions for a temp dir. I will now back up before I import assets and every night. Now Im really bitter.... but back to the back up.
     
    Tymac likes this.
  35. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Not helpful for you now, but as a general rule you should always use version management, preferably with offsite storage and commit and push changes very regularly (many times per day). I have a strong preference for git and there are many free off site repositories that support git that you can use.

    This doesn't only guard against situations like you're in now but gives you significant advantages to compare changes over time, revert files, commits, etc. I could not sleep at night if my code/projects were not committed and pushed off site.

    There are SO many things that can cause you to lose your work that you just can't predict. Not using version management is a decision that your ok with losing all your work at any moment.

    Just a few examples (some silly) that could happen at any moment:
    1. HDD/SSD crash
    2. Theft
    3. Fire
    4. Angry spouse due to you working on your project too much destroys your machine.
    5. Solar flare wipes your machine!
    6. Unity randomly deletes project due to a bug
    7. Operating System error trashes disk from bug
    8. Power spike destroys disk
    9. Ransomware attack gets you and encrypts your disk
    10. Police believe you're a bad guy an seize your equipment
    11. Spill coffee on machine and destroys it
    This list is endless, but you get the idea :) It's never a question of if, it's a question of when and are you willing to lose your work when it happens.
     
    radiantboy likes this.
  36. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    I do find the saving behaviour is a bit odd. Control S seems to only save the Scene so if you are saving a lot of things in prefabs or animations then it is easy to lose some work. I've got into the habit of hitting save scene and save project every time i save... not sure why this isn't the default for Control S. I don't get in many situations where I want to save a scene and not a prefab or animation or other asset i've been working on, and considering version control makes it easy to revert individual assets i think Control S should just save everything.
     
    larku likes this.
  37. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    So true my friend, and yet again it has needed to be pointed out to me. I keep all my "real" code in repos (android/java), but with unity I have always had major issues getting it to work in the long run, seems to crash n burn a week in, I bet it will again too- but I hope not. I am now putting every living piece of code onto private remote repos, because of that very list. I thought crashplan was working, but alas, its a bit crap. Thanks for the time to post the list. I have learned a strong lesson for the nth time, and never again will I need to learn it. Tomorrow I am github man, even though I have never got along well with it..!! I also believe crashplan can be great, I just havent configged it properly for so much data, which I did today based on their tech support. Im no longer bitter, im no longer bitter, need to keep repeating it, I still like unity, I still like unity... - insane grin and howl, slap of the head wwwwoaaaahhhhhhrrrghhhhiePLOPS ------ hopefully tomorrow brings back my sanity.
     
    larku likes this.
  38. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,051
    Where did you have your project stored? And did you ever try making a build?
     
  39. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    FWIW, I had something a bit like this happen a couple of months ago. I was fortunately in a test project, and was in the process of updating the plugins I was testing, so it was not a devastating loss. Anyway, I had the store window open in the editor and had clicked to update a few assets before importing them, and then - while I was watching, and while the updates were progressing - the Assets folder cleared. I could see everything suddenly disappear from my Project window. I thought at first that this was just a graphical glitch, but ... no. Everything that had previously been in the asset folder was gone, as was the asset folder itself (IIRC).

    This was the first project I had attempted to run under 5.6.0, so I was wondering if it would repeat ... but I've been using 5.6.0 exclusively since then, and no repeat of that behavior. I also checked out my disks for a "disk full" or hardware failure, but (knock on wood) there's been no sign of such.
     
    radiantboy likes this.
  40. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    On an SSD z:GDV15/GD/ my builds were working perfectly at this point yes.
     
  41. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Interesting this was unity 2017 b1, I think it is a rarely happening weird race condition or something to do with permissions or temp things. I dont understand though how unity even has the access to actually physically wipe these files. It is almost as it does something with the filesystem, or expect theyre in ram somewhere to copy them back, but it couldnt.. ah I dont knwo ive been up now 24 hrs pondering the whole thing, Im still confused how it is possible really. Thanks for all the feed back people, one more heineken and im letting my head rest on this one. Good to know you too saw it, then red items on the hierachy could literally be enough to give me a heart attack, let alone flipping to assets/ and seeing it EMPTY, apart form the latest crappy asset I grabbed.
     
    Last edited: Jun 19, 2017
    hopeful likes this.
  42. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Here's my .gitignore to get you started (in case it's useful):

    Code (csharp):
    1. ############
    2. # Unity3D .gitignore file.
    3. #        Store this file at the root of your local repository.
    4.  
    5. .DS_Store
    6. Library
    7. Temp
    8. Thumbs.db
    9. Browse.plb
    10. Browse.plb.meta
    11. Thumbs.db.meta
    12. *.csproj
    13. *.pidb
    14. *.pidb.meta
    15. *.sln
    16. *.unityproj
    17. *.tmproj
    18. apk
    19. *.apk
    20. *.userprefs
    21. .vs
    22. debug.log
    Good luck :)
     
  43. 5parrowhawk

    5parrowhawk

    Joined:
    Nov 5, 2013
    Posts:
    2
    Can confirm this just happened to me fifteen minutes ago.

    My Unity program is set up to call System.Diagnostics.Process to run an Arduino build and upload. What I didn't realize is that this creates temporary files in the directory where the process is being executed - in this case, the Unity project folder.

    I believe Arduino either locked the folder or accidentally overwrote some critical file, causing Unity to mislabel the project corrupted. All the project files, with the exception of the Lock file, evaporated into thin air. (I am quite sure that Arduino isn't supposed to nuke the entire contents of the working folder, so that is almost certainly on Unity.)

    Thankfully I only lost about half a day of work, but this is really not the sort of thing I want to see happening on a Friday evening...
     
    Last edited: Aug 18, 2017
    kevdome3000 likes this.
  44. The_Pro_Programmer

    The_Pro_Programmer

    Joined:
    Mar 29, 2017
    Posts:
    2
    Same problem here! I was working perfectly on my project in Unity 5.6 when suddenly errors started popping up saying it could not find certain script files. When i started to look for those files suddenly.............. My whole project window got empty. I got scared to death when i first saw this. First I closed unity to make sure nothing else happens. So I went to my folder where the project's files are stored through the windows explorer but still it showed there were no files in the assets folder. I opened my project in unity again wishing for better, but still it was no good. I was very angry at this moment because of a stupid little bug my whole project, which took months to make is now ruined!:mad: Please any one at unity try to solve this problem before it gets to destroy useful projects. I am just holding down my anger i cant explain how angry and disappointed i am.
     
    radiantboy and kevdome3000 like this.
  45. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    @applerty - Sorry to hear about this! It sounds similar to what happened to me, though fortunately for me I was working on a test project, so I didn't lose work.

    The funny thing (not really very funny) about this type of error is that of course Unity wants you to send in a project which reproduces the bug ... but you can't, because Unity erased the project! :(

    Since it defies easy reproduction and it happens rarely, I think it's going to be difficult to get Unity to pay any attention to this, and find and fix the bug.
     
  46. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    This thread was resolved, the OP's problem was with SourceTree and not Unity. If you are still assuming Unity is deleting stuff then please file a bug and report the case numbers. It was demonstrated that Unity doesn't go around deleting things but usually it's some form of os file issue or badly set up version control.

    https://unity3d.com/security

    Ensure you are also running patched versions of Unity. I doubt this issue is related but one cannot be too careful.
     
  47. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Ouch, that's terrible.

    Not helpful now, but really you should **always** have offsite backup (source control) for **anything** you don't want to lose. There are sooooo many ways you can lose your work. I highly recommend git, I commit and push off site in the order of 10 times a day. Only way to know you're not going to lose your work.
     
  48. maralexanian

    maralexanian

    Joined:
    May 2, 2018
    Posts:
    1
    Same thing happened to me just now. An entire project just disappeared. I had been saving every edit made but never relaunched Unity.
     
    CloudyVR likes this.
  49. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,051
    See above posts. Unity doesn't delete projects, if it happened it was likely user error, especially since no other details were provided. Closing as an unnecessary necro.
     
Thread Status:
Not open for further replies.