File headers taking HUGE memory space

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?

maybe this can help?

Did you cut off the log? It should say what in them down below.

I am not even using the Resources folder.

For what I read it doesn’t list the file headers below. But let me check again.

Ok after reading it again it seems Unity is using the ENTIRE Assets folder as the Resources folder for seemingly NO REASON:

Used Assets and files from the Resources folder, sorted by uncompressed size:
8.9 mb 3.0% Assets/Sounds/Music/ZBDevTrack.wav
8.4 mb 2.9% Assets/Sounds/Music/ZBDevTrack2.wav
4.0 mb 1.4% Assets/Sounds/Music/ZBDevTrack3.mp3
599.2 kb 0.2% Assets/Animations/FirstPerson/ArmsAK47.blend
523.5 kb 0.2% Assets/Animations/FirstPerson/ArmsDesertEagle.blend
507.0 kb 0.2% Assets/Animations/FirstPerson/ArmsRemington870.blend
449.4 kb 0.2% Assets/Animations/FirstPerson/ArmsFiveSeven.blend
425.1 kb 0.1% Assets/Animations/FirstPerson/ArmsGlock.blend
209.6 kb 0.1% Assets/Models/Items/M4.fbx
192.9 kb 0.1% Assets/Models/Items/Barrett M82A1.fbx
188.1 kb 0.1% Resources/unity_builtin_extra
184.7 kb 0.1% Assets/Scenes/Test1/NavMesh.asset
128.4 kb 0.0% Assets/Scenes/Test1/ReflectionProbe-0.exr
111.3 kb 0.0% Assets/Sounds/Guns/Fire/enfield.wav
106.3 kb 0.0% Assets/Models/Items/Enfield.fbx
105.6 kb 0.0% Assets/Models/Items/UMP45.fbx
102.8 kb 0.0% Assets/Models/Items/AK47.fbx

[...]

What do I do here? How do I change the Resources folder to the right one?

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?

1 Like

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?

1 Like

Ah, that makes much more sense. Thanks.

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:

-------------------------------------------------------------------------------
Build Report
Uncompressed usage by category (Percentages based on user generated assets only):
Textures 374.6 kb 0.9% 
Meshes 2.5 mb 6.0% 
Animations 1.8 mb 4.3% 
Sounds 21.9 mb 52.0% 
Shaders 125.3 kb 0.3% 
Other Assets 589.5 kb 1.4% 
Levels 536.8 kb 1.2% 
Scripts 900.6 kb 2.1% 
Included DLLs 13.3 mb 31.7% 
File headers 43.5 kb 0.1% 
Total User Assets 42.0 mb 100.0% 
Complete build size 100.8 mb
Used Assets and files from the Resources folder, sorted by uncompressed size:
8.9 mb 8.8% Assets/Sounds/Music/ZBDevTrack.wav
8.4 mb 8.4% Assets/Sounds/Music/ZBDevTrack2.wav
4.0 mb 3.9% Assets/Sounds/Music/ZBDevTrack3.mp3
599.2 kb 0.6% Assets/Animations/FirstPerson/ArmsAK47.blend
523.5 kb 0.5% Assets/Animations/FirstPerson/ArmsDesertEagle.blend
507.0 kb 0.5% Assets/Animations/FirstPerson/ArmsRemington870.blend
449.4 kb 0.4% Assets/Animations/FirstPerson/ArmsFiveSeven.blend
425.1 kb 0.4% Assets/Animations/FirstPerson/ArmsGlock.blend
209.6 kb 0.2% Assets/Models/Items/M4.fbx
192.9 kb 0.2% Assets/Models/Items/Barrett M82A1.fbx
189.3 kb 0.2% Resources/unity_builtin_extra
184.7 kb 0.2% Assets/Scenes/Test1/NavMesh.asset
128.4 kb 0.1% Assets/Scenes/MenuTest/ReflectionProbe-0.exr
128.4 kb 0.1% Assets/Scenes/GameTest1/ReflectionProbe-0.exr

[...]

The game seems to work just fine, and might be even smoother.

Thank you for the help, is there anything else I could do to compress it even further without having a noticeable effect in my game?

You could enable asset compression in the build settings.

1 Like

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.