0
\$\begingroup\$

I've created a script that generates assets bundles by compressing sprites using LZ4 compression. I need this in order to generate smaller files that I'll download from a server at runtime but after taking a look at those bundles. I've found out that they actually have a higher size than the uncompressed sprites. For example, I've generated a bundle from three sprites that have a size of 201KB together, but if I take a look at its generated bundle, its size is 300KB. This is only one example, there are other bundles that are 6MB but their original files are only 500KB and that doesn't make any sense to me. Can someone point me in the right direction?

\$\endgroup\$
  • 1
    \$\begingroup\$ What can you tell us about these assets, their source format, and the destination format/quality settings you've applied? If you can walk us through a test case that will let us reproduce the larger bundles on our own machines, we'll have an easier time investigating and testing potential solutions. \$\endgroup\$ – DMGregory Nov 30 at 13:33
  • \$\begingroup\$ How does that script you created work? For all we know, that script could have a bug that duplicates data, or in some way creates more data than needed and adds them in the asset bundle. \$\endgroup\$ – TomTsagk Dec 2 at 13:46
0
\$\begingroup\$

Thanks for your answers, actually you guys gave me a hint of what's going on here and I've found out the solution for this. Well, it happens that it doesn't matter if you compress your PNG files with photoshop before, Unity converts those PNGs in a unity readable format which of course have another file size based on the import settings you are using. In this case, I was testing an asset bundle I've made from a group of png assets which were ~250 KB in total (as PNGs), but ~600KB as an asset bundle, I've tested many different texture settings with no luck, but after changing the resolution of those PNGs to something multiple of 4, I could make use of DXT5 compression which reduced the size of the asset bundle to something more normal.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.