Search Unity

power goes out, your project is now corrupted.

Discussion in 'Editor & General Support' started by zak666, Mar 7, 2022.

  1. zak666

    zak666

    Joined:
    Mar 3, 2014
    Posts:
    40
    any way to stop projects getting corrupted? every time the power goes out or flicks while working on project, the entire project gets corrupted and you have to start again from nothing loosing hours if not days and weeks of work.
    New HDD New Install. using 2021.2.9 (cannot use 2022 cause post processing dose not work, you set it up, but nothing shows on the game screen.)
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    version control (very important), automated incremental backups, UPS power supply..
     
    Vryken and PraetorBlue like this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Yes, ALL of these things that @mgear states above... Most likely what you call "corrupted" may only be a single bad file or locked file, and source control would instantly point out the problem file and let you recover.

    One thing to note is that sometimes the project's Temp directory (the one at the same level as Assets and ProjectSettings in your project) gets wedged in a way that prevents Unity from starting, so the answer in that case is to remove it, as it gets removed normally when Unity exits.

    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
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    My guess would be you're more likely getting corruption somewhere in the Library folder than in the project files themselves. That's where I've seen corruption most often. To resolve that you just close Unity, delete the Library folder, and reopen the project. The Library folder can take a while to rebuild, depending on project size.

    As far as the actual project files, as already mentioned you should use source control like Git or SVN. Then worst case you're only lost the work since your very last commit.
     
  5. e_Zinc

    e_Zinc

    Joined:
    Oct 31, 2019
    Posts:
    19
    Delete your Library and Temp folders when your power goes back on. I'd also just use something like Bitbucket, which is free for most devs. It's good to use version control so you can make crazy changes and go back if it breaks the game. Also allows you to upgrade Unity versions much easier. As a final note it's good practice to get used to version control if you ever want to go into the gaming/tech industry.
     
    Joe-Censored likes this.