Lately we really ran into the problem that we could not modify the scene without lag, starting a game in the editor took about 40 secs and saving almost the same time.
What we did and found out:
- First, this may seem trivial, but it’s really the poly count in the meshes. We reduced many meshes for the landscape to about half of the count they had before. Trick here was not doing better meshes, but since our meshes are like 300mx300m, we used decimation algorithms (ZBRush, 3dCoat). What’s really good is the reducer brush in 3d coat (beta tools) that allows you to reduce unseen spots of the mesh. So i.e. we have a mesh that is exported with 50k polygons and then reduced again to 20k by using the reducer brush. Still, this is a lot faster than doing it by hand.
- Second, the drawcalls: it’s not only about the polygons that the meshes have, but also how many times they are drawn. We found that we had a mirror script on the oases, that naturally has to render the scene again to create the reflections. But if that is done at great distances, too, you have like 10 oases in range and your scene is rendererd 10 times more often. So we created a script that turns that only on when the player is in a radius of 20m or so.
- third, and this is the most awkward thing we found out: If you try to rotate a 30k mesh which simply lies in the scene under the scene root, that’s no problem at all. If you parent it unter, say 3 empties, it gets so laggy that you can’t use the transform gyro anymore! So the really stupid solution is to keep ALL hierarchies as simple as you can. Every layer in the hierarchy seems to make unity calculate all the transforms again for the parent (which kinda makes sense, but the extreme lag doesn’t)
So now that we found all that out the scene is usable again and building the world of caravan is fun again. How much fun can games be if making them is a pain?