0
\$\begingroup\$

Disclaimer: I'm currently just exploring techniques and trying to save literal kilobytes just to see if I can. Please don't give me speeches about how development time is not worth it.

So I got a bit disappointed that my small game with literally 3MB worth of assets takes 70MB of disk space. It should be lower, right? If I try a WebGL build, it leaves me with 12MBs, so what takes so much on a Windows build?

After that I created a test project just to see what else I can do to get rid of Unity's default engine bloat as assets are already as optimized as they can be.

Empty project. 0 assets. No code, no textures, no sound, nothing to optimize on my end. One empty scene.

The build weighs 65MBs.

I went into Package Manager and disabled literally everything. All extra packages, all built-in packages. Then went into Project Settings and set highest possible engine code stripping quality.

That left me with 48MB build. Weirdly enough, Unity still left a lot of executables in Managed folder, e.g. the one for Physics, even though it is absolutely not used. I can remove them and the game will still launch without crashing... On that note, I could probably remove the crash handler and save another megabyte... But first, I'd like to see if I can go lower from Unity itself instead of decapitating build once it's done.

Anyway, what are other ways to actually reduce the filesize? Most articles and questions talk about asset optimization, or focus on WebGL and mobile, where empty builds are actually within sensible values. Any settings I could use or maybe even assets that help with that? I'd appreciate any tips.

Currently worst offenders are:

UnityPlayer.dll (28MB)

mono-2.0-bdwgc.dll (7.5MB)

unity default resources (4.7MB) - do I even need those default resources?

\$\endgroup\$
2
  • \$\begingroup\$ You should include the version of Unity you are using. When I started with Delphi, the exe in the early versions (D3) was around 0.3MB. Recompiling the same code 20 years later and it was around 27MB. \$\endgroup\$
    – Zibelas
    Dec 5, 2023 at 9:41
  • \$\begingroup\$ If updating Unity or on contrary, getting an earlier version would help, I’d consider this as one of the solutions. \$\endgroup\$
    – SurDno
    Dec 5, 2023 at 9:52

1 Answer 1

1
\$\begingroup\$

Without changing any build settings and fully empty projects, a minor increase in the game engine can result already in a bigger build size due to new features, bugfixes or other automatically included build settings. There are a lot of other things that can be excluded or are not needed but this will depend a lot of what your game actually is about.

Here is an example of version 2021.1.14f1 vs 2021.1.15f1

14f1 vs 15f1

The difference is already one file. The UnityPlayer.dll is also slightly bigger 27361KB vs 27376KB.

Anecdotally I can say that the earliest .exe I build with Delphi 3 were around 300KB. Rebuilding the same code 20 years later resulted in around 27MB for the same code with the newest version of Delphi.

\$\endgroup\$
1
  • \$\begingroup\$ Going back to 2019 LTS did actually shed 8MB off Mono build and 1MB off IL2CPP build. Lowest I got so far is 38.7MB for LZ4HC-compressed IL2CPP-backend build done in Unity 2019. \$\endgroup\$
    – SurDno
    Dec 5, 2023 at 12:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .