Cleaning Library Folder

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?

1 Like

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?

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.

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…

I wish there was some helpful reply here. My /Assets/ is 2gb but my Library is 42gb?? Artifacts folder is 36gb??

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?

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.

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.

2 Likes

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?

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.

1 Like