I just optimized a project’s textures to be much more efficient for a game that is meant for the web. I reduced the texture sizes from 160 MB to 7 MB, however the build is still quite big… 58 MB to be precise:
There are about 46 MB that I don’t know where they are coming from. Of course I understand that there are many elements from the build package itself that will add up to the size, but I wasn’t expecting that to be so big.
I was wondering, am I missing something here that I don’t understand regarding Build Sizes? Or maybe this is the size I should be expecting for a game even of this size?
Other details:
Built for WebGL.
Using Unity 2022.3.22f1
Built with the option to optimize “Build Time”, the folder itself yields 37MB of size. I’ve built with the option to optimize “Disk Size with LTO” and it yielded 29MB of size (still expected less, the game is quite small).
Configurations of note:
Textures and Audio are as minimum as can be for now. (Except for maybe using a Sprite Atlas)
Disabled post-processing for URP.
Strip Engine code is set to On and High.
Compression is set to Disabled since the destined client asks that it shouldn’t be compressed. With Brotli compression it ends up at 12.5MB approximately when building with optimized “Disk Size with LTO”.
If anyone can point me in the right direction, I’ll be grateful. Thank you in advance!
If we compare Complete build size - Total User Assets in the first image versus the second image we get:
Image 1: 47 Mb
Image 2: 20.1 Mb
I understand that the relationship between both numbers is most definitely NOT linear, but there’s a difference of about 27 MB between a clean project and a worked project without accounting Assets. What could that be? Is there a way of improving this? Is there a place where I can inspect what that difference accounts for?
Btw Kurt, thanks for helping, you have answered me so many times on the forums you legend
Also note that the build report lists uncompressed sizes. For the total size you do need to check what the size of the build folder is on the file system.
Particularly for WebGL you can shave off a couple MB by disabling any unused built-in modules in Package Manager, such as Cloth, Vehicles, Physics 2D and anything you don’t need (I typically disable all, look at the errors, and from that I can deduct which modules to re-enable).
Lastly, Player Settings => Code Stripping. Set this at least to minimal but as high as you can. You need to test each setting in the build thoroughly.
I removed all packages I don’t need and did the code strip you mention, amongst other changes as well (see the first post). The final size with building with the “Disk Size with LTO” optimization was 27Mb-28Mb (no Brotli compression, that’d be 13Mb, where we want to deliver they ask us not to compress it with Brotli or Gzip as they do it themselves).
Based on my research, the best reduction would be to go back to legacy pipeline, but I’m not sure how that would affect runtime performance for Mobile web. Opinions?
i think its worth the try (testing BiRP in separate project, to see difference).
there was also one tip in twitter (haven’t tested myself though).
if you disable Splash screen, you First must disable display unity logo!
(otherwise that image still gets embedded in build…, even if splash screen is off).