When building my game, I noticed that even though my game is relatively empty for the time being, it has a whopping 292 MB of file size, I used Unity’s editor log to check what was going on and found this…
-------------------------------------------------------------------------------
Build Report
Uncompressed usage by category (Percentages based on user generated assets only):
Textures 203.2 kb 0.1%
Meshes 2.5 mb 1.1%
Animations 1.8 mb 0.8%
Sounds 21.9 mb 9.4%
Shaders 124.1 kb 0.1%
Other Assets 589.4 kb 0.2%
Levels 574.3 kb 0.2%
Scripts 900.6 kb 0.4%
Included DLLs 13.3 mb 5.7%
File headers 191.8 mb 82.1%
Total User Assets 233.6 mb 100.0%
Complete build size 292.4 mb
File headers were taking 82% OF MY GAME’S FILE SIZE, it’s absolutely insane. How is this even possible?? I read it had something to do with using the Resources folder, but my project didn’t even have a resources folder, I then added one and kept it completely empty, but that had pretty much no effect.
What is the matter? Why do file headers take so much space?
I don’t think that’s the issue. I think those assets get included in the right categories. For instance, ZBDevTrack.wav would go to sounds in your original post.
In the build, which files are actually taking the most space? Which files take those 191.8 MB?
But it literally says “Used Assets and files from the Resources folder”, like it’s checking the Resources folder and reading what is inside of it (then proceeding to list literally every single asset because it thinks all of them are in the Resources folder). Why does it say that?
In the build, the game’s data folder is taking up 242 MB, inside of it there is a GI folder taking up 192 MB, a sharedassets0.resource taking 22 MB, a Managed folder taking 19 MB and a Resources taking just 4 MB. All the other stuff take less than 5 MB combined.
Is this “GI” folder the source of the issue? Why does it take so much memory?
I think the text could be clearer, but what it really means is “(Used Assets) and (files from the Resources folder)” as in All Assets + All Resources. I checked source code to verify that.
It could be lightmaps. What are your lighting settings set to in your project?
I had Auto Generate lights off but besides that I didn’t change anything from default settings (I am using Unity 2019.4.14f1 Personal).
The Sun was not referenced in the settings, so now I referenced the Sun in both built scenes and disabled Realtime Global Illumination, as well as changed it to “Compressed” in the Menu scene (since it barely uses 3D lighting anyway). This seems to have fixed it, now the project only occupies 100 MB total in the folder:
When you use Baked Lighting. Baked data may bloat the build size. This data is shown as “File headers”. Deleting the objects called “LightingData” will solve bloated size. These objects are generated when you generate lighting and even if you decide to use real-time lighting these data may be included in the build. You can delete all “LightingData” objects and check if it reduces File Header size. If visuals get visible worse or real-time lighting slow on the target device you can regenerate lighting data with different settings.