Library/metadata folder growing too fast

Okay,

I have a folder containing 42 png, each png weight about 23ko, which makes my folder weight about 1Mo.
When I had this my resources and after Unity imports it, it adds exactly 57Mo to the Library/metadata folder !!

How can I reduce this ? As I have about 10 times more png which lead me in the end with 6Go of the metadatas for only 100Mo of png…

That’s natural - PNGs take much less space than uncompressed images. However, you don’t have to commit Library folder to source control, as Unity can always regenerate its contents (although it might take time to do it with many files, hence Unity uses a library folder to do it once the first time the project is started).

Thanks but I don’t have any versionning tools.

As I understood, the Library/metadata folder contains datas to make it easier for unity to use files.
And for the moment it’s generating a 1Mo file for each PNG. Are they uncompressed ?

Yes, spot on. Instead of decompressing every time you need to load the image, it does it once and stores the result in the library folder.

Understood, but the problem now is the size of resources in my build.

I read that the metadata folder does not represent the actual size of the build: Assets folder 312MB Library/metadata folder 1347MB - Questions & Answers - Unity Discussions

But for the moment it weights 3Go and so is my resources.assets in my build which I hope shouldn’t be the case.

I suppose you’re importing images for textures? You can enable texture compression, which will significantly reduce their size in the build.

Unity doesn’t use PNGs for anything aside from importing. Once imported, the source file is irrelevant, and the only thing that matters is the compression settings in Unity.

–Eric

Thanks for your answers, I will try as soon as I get my hands back on the project

Hello,

I’ve put all my textures format as compressed and yet when I build the size of the resources.assets file is still as high (3Go) as the Library/metadata folder.
Otherwise my assets folder is only 194Mo…

Did I miss something in my build settings ? Do I have a bug that I should report ?

Have you quit and restarted Unity? After deleting and changing a lot it takes a restart for it to clean up the library.

Yes I did, nothing changed. I have to make a professional delivery in 2 weeks so it’s quite problematic.

Does the metadata folder clean itself up? If I delete a png from my assets, does the corresponding uncompressed image get automatically deleted from my Library? Or is it good practice to delete the Library once in a while? Because mine is huge.