- Home /
Unity Build Memory Usage Patterns
Hi all,
We are on Unity 4, and are hitting build issues now that our project has reached a certain size. We got away with this for a while by running builds in batch mode, but we've exhausted the savings from that now.
Unfortunately, the structure of the game requires that a lot of assets are not tied to particular scenes, therefore are included under the Resources folder. We are now hitting the 32-bit process limit and crashing.
I wanted to see if my understanding of my options is correct, if someone with a deeper knowledge of memory usage during the build process was able to chime in I'd be really grateful.
So, as far as I know, Unity builds assets on a scene-by-scene basis, and tackles stuff in the Resources or StreamingAssets folders separately. Obviously some of the memory 'load' is therefore split between the build preparation for each scene, and stuff gets unloaded once a scene is built. But the problems come from the monolithic asset folders like Resources.
Does anyone understand what happens during this part of the build? Does it deal with assets on a type-by-type basis? Or path? Does it prepare assets in batches, or serially? I'm assuming it must hoover up a bunch, bake them down into the build then move on , but what's the process? If I have too many large assets of a single type am I more likely to hit the 32-bit limit?
Is there any way to mitigate this by doing things like using multiple resources folders? Or perhaps even by including a dummy scene in the build which had some of the resources assets in its hierarchy (which could force them to be built during the 'scene build' stage, and skipped later)?
Basically, are there any other options other than remove or shrink assets? Can anyone shed light on some of the internals of the build process?
I can't help you with all of the questions but regarding the multiple Resources folder approach, I don't think that would work because Unity puts everything that is in a Resources folder anywhere under the Assets folder in a combined Resources folder for the build. Splitting the Assets in the Resources folder into a few Asset Bundles (http://docs.unity3d.com/ScriptReference/AssetBundle.html) and loading them from disk (depending on the target platform that might be annoying) when the game starts/you need them would probably work here
Your answer
![](https://koobas.hobune.stream/wayback/20220612063107im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Getting the current BuildOptions 1 Answer
Batch File and Script to Make Multiple Builds 1 Answer
How to create a BuildOptions mask in the Editor Window? 2 Answers
Building Question 1 Answer