- Home /
Static Batching with LOD Meshes/GameObjects & Other Questions
I want to buy a Unity Pro License, but before I do I would like to ask some questions to make sure that what I am trying to do will work with the Unity Pro features.
I am procedurally generating a terrain (set boundaries) at startup. The terrain consists of multiple meshes, all different, using the same material. I have the project set up on Unity Free Version, and when I see the 'stats' it says i have 200-300 drawcalls, depending on how many chunks of the terrain are visible. I also have many levels of detail for the chunks, but since I do not have Unity Pro I am rendering all the chunks at 1 constant LOD. My question is, can many procedurally generated meshes with LODs be statically batched at runtime? Also, at runtime, I would like to make certain chunks 'unstatic' to be able to move them and eventually destroy them. Most chunks will remain static, but when a certain event happens, i would like to detach certain chunks from the terrain by marking them as not static and then giving them a rigidbody to let them fall. (not to be confused with unity terrain, this is custom meshes.)
TL;DR: Can Procedural Meshes with LODs be statically batched at runtime and can I toggle static batching on them via the static flag?
Answer by rutter · Sep 01, 2014 at 06:03 AM
You can use static batching at runtime, but it doesn't work in quite the way you're expecting.
The "static" checkbox doesn't really exist as such, once you're in a built player. You can check the value, but setting it won't really do anything.
Instead, you use the StaticBatchingUtility class to prepare a group of statically batched objects. This is actually how the editor does it during the build process. There are a few limitations about material atlasing, vertex count and so on, if you really want to scrape out every bit of performance that you can, but for the most part it "just works".
I haven't done much testing between LOD grouping and static batching, unfortunately. I can find some reading on that topic, but you might have to do some searching for more.
Your answer
![](https://koobas.hobune.stream/wayback/20220613162008im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Materials disappear on Mobile when more then one is set to static batching. 0 Answers
custom staticBatchRoot for build time static meshes? 1 Answer
Simple LOD not working correctly. 0 Answers
Problem moving static batch root when using StaticBatchingUtility.Combine 1 Answer
Procedural meshes: static batching seemingly inoperative. Cause? 1 Answer