i’ve been experimenting to see how to get best performance on mobile with a large scene with lots of objects. Currently playing with LODGroups, which is pretty slick. Making my massive forest of trees use LOD groups almost tripled my frame rate, but even better was marking them all as static , which made the performance fantastic.
So my question is, does unity still do static batching even though the meshes of individual objects are switching and being turned off independently? Sure seems to be working that way, so I’m curious how. Because if that is possible, can I manually turn renders of individual static objects off/on at runtime? I’ve tried this before but couldn’t get it to work, which I thought made sense since all static objects are baked into one mesh, aren’t they?
Ok, let me just answer my own question. My memory must be failing me, because now i tried deactivating a single object that is part of the combined mesh and it disappeared just fine.
I think I read that it’s because of how the mesh data is sent to GPU. There’s 2 sets of mesh data, ones the complete data, verts, normals, etc, and another that’s just an index. Turning off an object must turn it off in the index, and then gpu knows not to render the one object. And this is how the culling would work, being able to turn on/off objects based on whatever culling is in action.
And LODGroup is probably same idea, i.e. gpu has full mesh data for all static objects, including high and low res meshes, and the mesh index is updated every frame and passed to GPU to tell it which mesh to turn on/off.
Took an hour or so to figure this out, sure would be nice if the documentation was a bit more comprehensive…