Levels size extremely big in Build Report

So I’m having a simple mobile game and the build size is 450mb even with the highest compression. I checked the Build Report and it’s the “Levels” that take up 91.9% of the entire thing.

7393574--902897--Screen_Shot_2021-08-05_at_17.05.35.png

I tried to google it and all I find is about static batching, yet I don’t use any static gameobjects/prefabs and even if I disable it in the Player Settings it doesn’t make a difference.

My game has 2 scenes, one is the async loading scene and the other the main scene. My levels are done with prefabs sitting in the Resources folder (and only loaded when needed) and each level prefab is about 100-200kb in size according to the same Build Report. Total amount of levels is 80, so total size of level prefabs should be not bigger than 20mb or so.

In case that the size of the prefabs is not correctly shown or gets translated different into “Levels” (maybe because of using Resources folder?) I made a build with only 3 levels. I literally deleted all the other level prefabs from the project. Nonetheless, the amount of 433.5mb didn’t change at all. So pretty confident it’s not the level prefabs, right?

What else could it be or where should I look?

One last thing that I feel might be related, this project is not a fresh unity project but rather build on top of another project that I did before. I used the old one like a framework so I didn’t had to re-do everything from scratch. I did delete all previous prefabs and objects from the project of course.

Any help appreciated.

That does seem a bit chonky. You should be able to see what scenes are what (I forget where that is spewed; editor console log maybe?), but if you can’t, then try chopping out the last 40 levels and building, see if the size goes to half, or if it barely changes, because there might be one scene with something degenerate in it that triggers a massive block of something getting placed in the binary.

1 Like

As said, I did a build deleting before all but 3 levels. So 77 level prefabs were gone. It didn’t reduce the size at all. :frowning:

So if it’s in the scene it’s weird too because the loading scene has nothing but a logo and the async script and the main scene basically has the UI and the game managers with all the logic.

In the meantime I tried to delete the library folder but that didn’t changed anything either.

So still lost…

How could I find out what is degenerated that triggers that block of something getting placed in the binary? How to debug?

Upon further research and help from some fellow devs, I saw that my main scene took 929mb on disk. I compared with my original project that I used as a base framework for this new game and there the same scene only was 26mb big. So something definitely got weird here.

I copied all the GOs over to a new scene and voilá, problem solved. Levels are taking now 11.2mb instead. I can’t believe that the solution was this simple. :slight_smile:

Hopefully this helps someone else in the future. But if it’s not static batching, this might help some.

2 Likes

Thanks for coming back to post that. I have noticed some constructs in a scene will make it slowly grow over time, like certain ways of serializing classes: every time you change it, the scene “journals” the changes, stacking them on. But wow, I’ve never seen anything more than a few kilobytes, certainly not a gigabyte! Smells like a scene-file-writing bug to me!!

One thing that I have seen mess up a scene file is to open it with a newer version of Unity, then go back to an older version. All bets are off in that case, as that is not supported…

Bro, how did you end up fixing this?

Did you actually read anything before posting?

1 Like

I see something similar, like my scene is 44 meg before build and 626 meg after build, is this usual?

1 Like