Why my Build Size is so large?

As you can see from the Build Report(For Android Build):

Build Report
Uncompressed usage by category (Percentages based on user generated assets only):
Textures               14.6 mb	 33.0% 
Meshes                 3.7 mb	 8.4% 
Animations             640.0 kb	 1.4% 
Sounds                 570.7 kb	 1.3% 
Shaders                3.2 mb	 7.2% 
Other Assets           21.1 mb	 47.7% 
Levels                 0.0 kb	 0.0% 
Scripts                304.4 kb	 0.7% 
Included DLLs          0.0 kb	 0.0% 
File headers           121.9 kb	 0.3% 
Total User Assets      44.2 mb	 100.0% 
Complete build size    2.2 gb

The “Total User Assets” are only 44.2 mb but the complete build size is 2.2 gb.
Why is this? Also the Apk I made is 874 MB which is quite large for a low poly and optimized game.

Any help would be greatly appreciated!

1 Like

There are some tools in the Asset Store that you can use to analyze the situation in your build.

@makaka-org

Can you suggest me some free alternatives for that?
Also, this still doesn’t answer the original question. I am curious to know why it happens!

1 Like

Actually, since 2016, I use the paid one. But I just found the free thing that Unity is working on: GitHub - Unity-Technologies/ProjectAuditor: Project Auditor is an experimental static analysis tool for Unity Projects.

Reasons: Garbage, Huge Baked Lighting, etc. in your Project.

I don’t have baked lighting in my game though.
Could you please explain more about “Garbage”?

1 Like

Unused Assets, Unused Scenes included in the Build Settings

1 Like

Are you using Addressables, Streaming Assets, or copy files to the build in other ways? Those will count towards the “Complete build size” but won’t show up in the breakdown.

You could implement OnPostProcessBuild, which gives you a BuildReport that contains information and sizes of the files in the build. I guess this is where the paid reporting tools get their data from.

You can also just unzip the apk/abb and check which files inside take up all of the space. I e.g. have the issue that local Addressables group files accumulate in successive builds, bloating the size. You’ll only discover issues like that by inspecting the actual build data.

The question is about the discrepancy between the “Complete build size” and what Unity counts as “User Assets”. Unity cannot know if a scene is unused and would still count it and everything it references as user assets. Unused Assets are not included in builds, unless their in a Resources folder, in which case Unity again cannot know if they’re actually unused and should still count them as user assets.

I am not using Addressables or Streaming Assets.

Then analyzing the actual build would be best. Rename the APK/ABB file extension to ZIP, extract it, and use something like WinDirStat to see where the missing GBs are coming from.

This Unity Hacking Guide has some details on what the important files in the build are and some tools you could use to see what they contain.

1 Like

Ok! I will try that.

1 Like

Alright, I tried that and observed this:

After unzipping the file, I found out that the “lib” folder comprises 121 MB and the “assets” folder comprises 816 MB. These two are the main contributors.

1 Like

The “lib” folder contains the code, both Unity’s native code (“libunity.so”) as well as converted C# code (“lib_burst_generated.so” and “libil2cpp.so”). You could try reducing the size of the second by removing unused code and packages in your project or by increasing code stripping.

The “assets” folder contains all the non-code assets. You have to dig into it to see how the size is distributed. The “bin/Data” subfolder contains your scenes (“levelX”, including assets only used in that scene), “sharedassetsX.assets” (assets used by multiple scenes) and assets from Resources (the files that have only a hash as name).

Does the “assets” folder contains anything besides the “bin/Data” folder?

It contains more than that:

Also, I am using Unity ads mediation package

@Adrian


This is what I got.

The assets are only 70 MB but my aab is 750 MBs!!!

1 Like

Maybe because .aab is a container that contains multiple versions of your app for different architectures. When downloading from the store, there will be a correct size for the user.

I believe that you can see it in the Play Developer Console after uploading.


For testing purposes, you can disable Build App Bundle (Google Play) in Build Settings, and generate APK instead of AAB, and check the size.

@makaka-org

The APK is also about the same.
I couldn’t figure out why the size is so large.!

Let’s take clear experiment.

  1. Upload .aab to Google Play.
  2. Download via Testing Track on Your Phone.
  3. Check the size in the Settings of your Phone.
1 Like

Checking, Standby.

Check the size also before downloading in the store page because it will have smaller archived size.