- Home /
How can I combine object pool objects in a single draw call ?
Hi guys,
I am using object pooling to activate and deactivate objects when i need them and I just understood that each time an object from object pool is instantiated a new draw call is made. And if I need for example to activate 10 object from object pool I would have 10 draw call which reduces my game performance. Is there a way to combine these object meshes and materials which are the same ? Because at the object pool I have only one object instantiated inside the pool 10 times so there might be a way to batch all these object together into a single draw call.
If someone can give me an idea or share with me some scripts would be nice. Also, my object pool is instantiated at runtime so the objects need to be combined at runtime.
Thank you, Gerald.
Answer by Bodhid · Aug 11, 2017 at 01:21 PM
Every object should have the same shared material.
get / create a material and set them to the objects with GetComponent().sharedMaterial
Also make sure that your objects fall under the criteria specified under Dynamic Batching section from this Draw call batching page of Unity manual.
Actually the reason why object pool was not batched was with the pooled object which had a high number of vertices. I did a test with a primitive object and draw calls started to be saved by batches. thnx for the reply.
Your answer
Follow this Question
Related Questions
Dynamic Batching + VertexLit + PointLight = 1 Draw call? 1 Answer
Drawcalls vs MeshCombiners 1 Answer
Trouble Understanding Rendering Statistics Window 2 Answers
Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer
Questions about toon basic outline shader, batching and draw call 2 Answers