Ideas about what is causing one level to build out at 7gig?!?

Hey all,

I’ve never had this problem before…

My team and I working on a low-key sim that utilises a 4*4km terrain using Unity 2021.3.6f1. There are ‘straight-from-the-asset-store’ models (which means more drawcalls than I’d like) and some VR thrown in there as well.

We did dabble with Lighmapping and occlusion culling, but removed all of that as they were of no use after testing.

TLDR:The problem is that (ignoring the performance for now) the level in question is building out to be 6.9gig, takes far too long to load and hogs all the memory!!! How do I find out exactly what is causing this bloat?

I’ve installed the Build Report Inspector, and am currently building again to get the editor log as well. But what should I be looking for?

As always, kind regards to all,

Mike
UPDATE: Here’s an excerpts from the Editor.Log - advise if more is needed:

Textures 782.7 mb 75.9%
Meshes 170.6 mb 16.5%
Animations 663.4 kb 0.1%
Sounds 7.4 mb 0.7%
Shaders 9.7 mb 0.9%
Other Assets 59.7 mb 5.8%
Levels 0.0 kb 0.0%
Scripts 309.8 kb 0.0%
Included DLLs 0.0 kb 0.0%
File headers 198.7 kb 0.0%
Total User Assets 1.0 gb 100.0%
Complete build size 7.7 gb```

What Unity version?

1 Like

Apologies, we are using Unity 2021.3.6f.

Do you use adressables or something like that?
And do you use a Resources folder in your project?

1 Like

No. We’ve never had a need to investigate them, and because its always full on pace (new project, straight after another, each one totally different. Have to get them out to the client in 1 month, maybe 2…) we just havent had time to look into what has not been needed for thale particular project in question. I have looked into them a bit in my own time, but didnt (and perhaps, mistakenly so) they wouldnt be suitable for this project.

The problem with this project is that the client has to be able to zoom in to a ridiculous degree on their remot camera in the scene, so importing objects on the fly might not be possible without causing massive GC issues… right? Or am I barking up a wrong tree…

Mike

Loading objects is about memory, not storage size. If you have a folder called Resources, all files in that will be included in builds

1 Like

This still doesnt answer why one level is so big when, according to the editor log, there aren’t enpugh assets to justify that size

But to answer your point about a resources folder directly: we dont use one.

Maybe upgrade unity and delete the Library folder and build again?
If it then still happens make a bug report

1 Like

check also StreamingAssets/ folder,
try clear baked lighting if its still there (from lighting tab, the small dropdown arrow near bake)

Also if baked colliders are enabled, that increases build size, but i think it should show in that stats…
Check editor.log for the list of assets from biggest to smallest. (after build, if that build info plugin doesnt do that)

also one time i had issue where copying objects from Scene A into new fresh Scene B helped reducing scene size.

2 Likes

This is something we tried and had running at about 18:30 last night, minutes before your suggestion, ha ha. We didn’t upgrade to a newer version of Unity, but we did delete the Library, Object & Logs folders before reimporting all and rebuilding. No Change :frowning:

There is an example of this in the OP - nothing is jumping out as a large asset. But I don’t believe this includes Unity Combined objects… which brings me to the ‘solution’

This got me thinking, so I checking into it and realised that by setting the terrain and associated scenery objects to static, Unity was combining everything into a single mesh for Static Batching. This means that all the bushes that line the road are added, separately, to a baked mesh… all several thousand of them! This appears to be the issue.

Our chosen solution: We’ve kept everything as static (changing the one flag will cause issues with prefab importing as there’s so much in a ‘nested prefab’ architecture), but simply disabled Static Batching in the player settings. This has changed a 7gig built scene to a more manageable 97mb scene.

Thank you for your assistance and replies. It is very much appreciated and helped me stay just this side of sane being able to bounce something off of you (no, seriously!).

Again, thank you:smile: