Search Unity

Cleaning Library Folder

Discussion in 'Editor & General Support' started by atmuc, Feb 13, 2021.

  1. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,166
    When I delete some files from project in the editor, Library folder size doesn't change. Unity editor doesn't remove imported files from the Library folder, even after I restart unity editor. When I reimport all assets in the editor, Editor removes unnecessary files from library folder.

    How can I clean library folder without reimporting all assets or changing build target?
     
    LilGames likes this.
  2. FrankvHoof

    FrankvHoof

    Joined:
    Nov 3, 2014
    Posts:
    258
    The Library folder holds 'cache'-data about your project that the Editor uses.
    This data will differ between different Editor-versions, OS's and even just between different PCs in general (which is why it shouldn't be a part of your project-repository on e.g. GitHub).
    I'm not sure why/if the Editor would keep this meta-data around after the asset is deleted.
    Is there any file/folder in particular that is causing your Library-folder to 'balloon' in size?
     
  3. ciathyza

    ciathyza

    Joined:
    Aug 16, 2015
    Posts:
    110
    The Library folder is one big grievance of Unity! My current project is 58GB for the Asset folder alone. The Library folder adds another 33GB. Sometimes after adding and removing assets you simply have to clear the Library folder or the project will become very messy (stuck warning messages, unused garbage left overs, etc.). But clearing the library folder can also mess up the project's imported assets sometimes.
     
  4. Endlesser

    Endlesser

    Joined:
    Nov 11, 2015
    Posts:
    89
    For me Library folder is 10GB currently and I start to worry what it becomes next. `Artifacts``BuildCache``PlayerDataCache` seem to be the heaviest folders, not sure these are essential or redundant.

    Library is bigger and bigger it will drive me nuts sooner or later...
     
  5. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    570
    I wish there was some helpful reply here. My /Assets/ is 2gb but my Library is 42gb?? Artifacts folder is 36gb??
     
  6. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    146
    how can one clean these folders?
    is it possible in the UI, some settings view has a button?
    can the folder simply be deleted?
    whats safe?
     
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,789
    Why do you want to "clean" it?

    In any case, backup first, just in case, then close Unity, delete the Library folder, re-open Unity, then wait 20 to infinity minutes depending on project size for project to re-open and Library to be rebuilt.
     
  8. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    755
    After unity rebuilds your library file, you will likely get a whole bunch of scary errors.

    Restart unity, you should be good, except for shaders, which will also need to recompile.
     
    sirleto and AcidArrow like this.
  9. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    146
    i would hope that "cleaning" it reduces it down from gigantic to realistically needed.
    as others stated, if you have an active project in which you add and remove content, it seems that folder just accumulates files and never deletes them (if not needed anymore).

    or am i wrong with that suspicion?
     
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,789
    I've developed a habit of deleting the library before opening the project with a newer Unity version (or maybe every other version, if we are say, in a new-ish LTS and the updates to it are frequent), which means I'm deleting the Library roughly once a month. I think more than that is overkill.
     
    sirleto likes this.