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:
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…
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.
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
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!).