- Home /
Multiple instances of static mesh increase size of game build
Hi, everybody! There's some problem.
I have a prefab of the mesh with 1k tris in my project. When the static option isn't checked no matter how many instances of the prefab I'll put to the scene, the size of the game build remains the same. But if I check static, every instance of the prefab increases the size of the 'mainData' file by 60k Bytes.
Why does it happen? And how can I use multiple instances of static geometry without increasing build size?
Thank's a lot for any help.
Answer by azmundai · Jun 05, 2013 at 05:31 PM
http://docs.unity3d.com/Documentation/Manual/DrawCallBatching.html
Static batching, on the other hand, allows the engine to reduce draw calls for geometry of any size (provided it does not move and shares the same material). Static batching is significantly more efficient than dynamic batching. You should choose static batching as it will require less CPU power. In order to take advantage of static batching, you need explicitly specify that certain objects are static and will not move, rotate or scale in the game. To do so, you can mark objects as static using the Static checkbox in the Inspector:
Using static batching will require additional memory for storing the combined geometry. If several objects shared the same geometry before static batching, then a copy of geometry will be created for each object, either in the Editor or at runtime. This might not always be a good idea - sometimes you will have to sacrifice rendering performance by avoiding static batching for some objects to keep a smaller memory footprint. For example, marking trees as static in a dense forest level can have serious memory impact. Static batching is only available in Unity Pro for each platform.
But how does this affect size of the game build? This is concerning RA$$anonymous$$, additional geometry is created in runtime, isn't it?
Thanks, I've left out that static batching may be performed at build time.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Instantiate in Editor 1 Answer
How to force static batching being performed at runtime? 0 Answers
Checking if object intersects? 1 Answer
Unity Editor doesn't render properly 1 Answer