Search Unity

Safe to delete folders and files?

Discussion in 'Editor & General Support' started by Khazmadu, Jul 18, 2017.

  1. Khazmadu

    Khazmadu

    Joined:
    Jun 24, 2017
    Posts:
    92
    I thought I can delete everything but the Assets and the Project Settings Folder.
    But after doing that my game was broken. (I made a backup first)

    What Folders and Files can I delete without affecting the project in any way?
     
    dvdmontagut and aymusbond like this.
  2. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    The Assets and Project Settings folders are your project and are all you need to backup/put on SVN,etc. You can delete anything else. The Library folder will be recreated when you next open the project.

    Update: Since I made this post the Packages folder has been added - and this will need backing up too.
     
    Last edited: Feb 21, 2022
  3. Khazmadu

    Khazmadu

    Joined:
    Jun 24, 2017
    Posts:
    92
    Maybe there was an error while creating the Library. Thats exactly what I did and it still damaged my project.
     
  4. UnrealStompy

    UnrealStompy

    Joined:
    Apr 20, 2018
    Posts:
    2
    When I delete the Library and then try to reopen my project, it is all gone. I am not sure why it is doing that (when the above says it's ok) But it would be nice to have clear guidance as to how I can minimize the size of my project before archiving it. Seems really dumb to save 10GB of Baked Light data (when it regenerates when I open the project anyway)
     
  5. McRanna

    McRanna

    Joined:
    May 6, 2019
    Posts:
    1
    I'.m having the same issue. When I delete lib folder my game is ruined. Did you ever find a solution to this?
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    If you ONLY delete your /Library folder, and there is an issue on next project opening, that would likely be a bug. Please try to reproduce on a new/empty project (i.e. a SMALL project)
     
    AldeRoberge and Smireles like this.
  7. master_rigel

    master_rigel

    Joined:
    Mar 24, 2014
    Posts:
    69
    You will need to keep your
    assets folder
    ProjectSettings
    Packages

    It's safe to delete the library folder.
     
  8. ajeets1978

    ajeets1978

    Joined:
    Mar 10, 2019
    Posts:
    25
    I deleted the Library folder only, and after that game's UIs are all messed up, it doesn't appear as it should be or was before deleting the Library folder. example all the images on panels and buttons are not appearing they are now apearing as white color
     
  9. krisventure

    krisventure

    Joined:
    Mar 24, 2016
    Posts:
    118
    After deleting Library folder the Editor layout settings were reset, the build settings changed from iOS to Mac and I'm not sure if the rest of my Project Settings remained as it was or not (because of the mentioned changes). I've customized a lot of things in my project settings I can't recall every detail. Obviously, I haven't deleted my project settings. I simply deleted the Library folder to let it be re-generated. That's all. So why would that overwrite my project settings upon re-opening / re-building the library? I had something similar happen to me a year ago, the last time I dared to follow the official advice that it's 'safe to delete if you only delete the Library'. Back then I had to revert, and now again I have to revert my project to backup. My advice to everyone: Never delete the Library folder!
     
  10. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    In my experience it's safe to delete Library.
     
  11. krisventure

    krisventure

    Joined:
    Mar 24, 2016
    Posts:
    118
    In my experience it's not :)
     
    Last edited: May 11, 2021
    jmcgraw961 likes this.
  12. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The currently layout is stored in your Library folder. Saved layouts are stored outside of your project folder and aren't tied to a specific project. You'd just select your custom layout again when you delete the Library folder. If you create a custom layout, you should save it (Window -> Layouts -> Save Layout...).

    Where custom layouts are saved:
    On Windows: %APPDATA%/Unity/Editor-n.x/Preferences/Layouts
    On OSX: ~/Library/Preferences/Unity/Editor-n.x/Layouts

    As for your project settings, Unity projects are commonly used with source control (Git, SVN, etc), especially with bigger projects and all of Unity's big customers, and you don't check the Library folder into source control. Every time you check out a fresh copy of a project from source control, you're building a new library folder from scratch. If there was a general problem with project settings getting screwed up every time that happened, you'd have all the plus/pro Unity subscribers breathing down Unity's neck until that was fixed and endless crying about it on the forums.

    Since that doesn't seem to be the case, I have to assume something else happened to your project settings.

    On a side note, you should really be using source control yourself. If you were, this project settings issue would be fixed with just a single command, wasting no more than 30 seconds of your time. (eg. svn revert)
     
    Last edited: May 11, 2021
    Giantbean, andymads and Lurking-Ninja like this.
  13. krisventure

    krisventure

    Joined:
    Mar 24, 2016
    Posts:
    118
    Yes it is fixed in 30 seconds by reverting to the old Library, never said it wasn't. Is that a solution though, having to revert? Not really. Not when the goal is to delete-rebuild the library in the first place (some corrupted files can get cleared up by re-building, or that was my hope at least).

    Now I've managed to get it working without reverting the whole Library folder. I had to revert the Project Settings folder alone. Because like I said some build settings mysteriously changed in the process of deleting / rebuilding the Library. It doesn't make sense, I know, it shouldn't have any way to overwrite / ignore the untouched Project Settings, but it did. My project was set to iOS, I've never changed that, and I just closed Unity, deleted the Library folder and restarted Unity. There's very little room for "something else" to happen between those two steps.

    And this wouldn't be the first bug that is rarely reported because it rarely occurs. But it did occur to me now and last year I had something corrupted too when I tried to rebuild the library. I guess I'm just not lucky then. But from where I stand I can't call it safe.
     
    AndreiMarian likes this.
  14. mamenaware751

    mamenaware751

    Joined:
    Jul 31, 2021
    Posts:
    1
    yeah its. fine if you deleted Library folder, when you open project again it will restore whole libary folder
     
    AldeRoberge likes this.
  15. QuickiSticki

    QuickiSticki

    Joined:
    Nov 18, 2020
    Posts:
    26
    For anyone visiting this, the Legacy Documentation for Behind The Scenes notes at the bottom that with Unity 4.2 and earlier, it is NOT safe to delete the Library files, noting:

    "Projects created in Unity 4.2 and earlier may not have .meta files if not explicitly enabled. Deleting the Library folder in these projects will lead to data loss and permanent project corruption because both the generated internal formats of your assets and the meta data were stored in the Library folder."

    Unity - Manual: Behind the Scenes (unity3d.com)
     
  16. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,443
    Dear ghods, I hope nobody's still trying to use Unity 4.2. Nobody's buying Blackberry 10 games anymore.
     
    SkylorBeck and QuickiSticki like this.