- Home /
How to reduce Drawcalls while having a lot of meshes in your scene?
Hi, Im making a farming simulator. And ive reached a stage where i have to Destroy or harvest crops. The problem that i am facing is that there are a lot of objects(meshes of the crops) in my scene. Because obviously a lot of crops make a field. Adding these meshes to my scene increases my Drawcalls to about 1.5K which is alot. Now i have tried to combine these meshes into a single mesh and i have succeeded so far. But In that case I Only have one mesh collider attached to the combined mesh. Which destroys the whole mesh when the mesh collider of my harvester collides with the mesh of the combined mesh. I donot want this. I want to destroy only those crops which collide with my harvester. Is there a work around? What should i do? Any help will be Appreciated!!
I honestly have no real experience or knowledge, but what I would try is using simple sprites for something like that. Two sprites where other is rotated 90 degrees and they are set up like X-formation. Then grouping up stack of these that will be removed at once when harvested and adding box collider to that group. If you combine meshes I doubt there is any easy or efficient way to remove parts of it.
Also as side note you shouldn't destroy at all as Instantiating and Destroying is really inefficient. Ins$$anonymous$$d of that you should use objectpool where you just disable/enable objects.
Answer by AurimasBlazulionis · Feb 15, 2017 at 02:38 PM
This is what static and dynamic batching is about. It tries to combine the meshes.
If you are building the game for PC and modern Android (GLES 3.0+), you can also use GPU instancing. It will be able to draw the same meshes efficiently. For it to work, the meshes have to be not batched, have same mesh and materials. Shader also has to support it, the standard one seems to work.
Disable dynamic batching and in profiler, open frame debugger, all the grass should have instanced mark.
Try to have the same material on every object.
Your answer
Follow this Question
Related Questions
destrucatable pillar 2 Answers
Using Mesh.CombienMeshes. 0 Answers
[C#] Using CombineMeshes and preserving originals 0 Answers
Gather all the Meshes into 1 1 Answer
Merging meshes 0 Answers