Search code examples
c#unity-game-enginemobilesize

Unity android apk suddenly way bigger in size?


I did some performance fixing to my Unity mobile game (set most objects to Static to save frames per seconds and performance).

And after that i built my game and instead of the usual 80mb it now has 350mb and i really have no idea why.

I also did some Project Settings>Quality teawks and some other stuff i saw on the internet but i am not really sure if that had any effects.

Does anyone know a possible reason?


Solution

  • Setting static is a trade off between memory usage and runtime performance. That performance boost is not for free. It comes in the cost of runtime memory and build time memory. Setting static will likely have resulted in many additional meshes being created and saved into the build. More efficient to render at runtime, but a greater memory cost.

    You can check this after building if you open the editor log. Near the bottom is a list with the size and name for all assets included in the build. The static meshes included will look like this:

    2.0 mb   0.5% Built-in Mesh: Combined Mesh (root: scene) 11
     2.0 mb  0.5% Built-in Mesh: Combined Mesh (root: scene) 2
     2.0 mb  0.5% Built-in Mesh: Combined Mesh (root: scene)
     2.0 mb  0.5% Built-in Mesh: Combined Mesh (root: scene) 6
     2.0 mb  0.5% Built-in Mesh: Combined Mesh (root: scene) 16
     1.9 mb  0.5% Built-in Mesh: Combined Mesh (root: scene) 10
     1.9 mb  0.5% Built-in Mesh: Combined Mesh (root: scene) 23
     1.9 mb  0.5% Built-in Mesh: Combined Mesh (root: scene) 5
     1.9 mb  0.5% Built-in Mesh: Combined Mesh (root: scene) 19
    

    enter image description here

    Investigate the editor log to find the largest assets after your optimization.