- Home /
How to reduce drawcall
I want to build a game for android. In the game you can collect coins. These coins has the same material. In the binging of the game I create enough coin and I put them into a pool so I can use them when they are needed without using instantiate and destroy continuously. How can I reduce the number of the draw calls? I cannot combine them into one mesh or can I?
Answer by robertbu · Aug 01, 2014 at 03:24 PM
In theory, you could create all your coins out of a single mesh, but before you go to those lengths, make sure your coins are batching, and then test the result on your target platform. You can see in the stats if your coins are batching. To batch 1) the coin mesh needs to have less than 900 vertex attributes, and 2) you need to not make any changes to the material on the coins at runtime. The number of vertex attributes will depend on how the mesh is defined, but typically you need to get under 300 vertices to get under 900 vertex attributes.
Once you have them batching, run a test on the target device. Keep instantiating coins until you see a slow down. Experiment a bit with simpler shaders to see how much the shader is impacting your performance.
Ok. Please treat me as a newbie. I have nothing int the scene but 3 coins and the camera and I get 3 Drawcalls. What to do next? Coins have less than 300 vertex
$$anonymous$$ake sure all the coins use the same instance of a material (i.e. the same material).
That doesn't yet mean they use the same material. If you change the color of one coin, do the others change as well? If not, you use different materials.
The easiest way to have them all use the same material is to make a prefab of one coin, then instantiate that prefab
I did that. They have the same material. I change the material and it changes in every single coin. I use this script to count the drawcalls: http://wiki.unity3d.com/index.php/Accessing_number_of_drawcalls_from_script
Your answer
Follow this Question
Related Questions
Improving custom shader performance? 0 Answers
moving thousands of objects is very slow, Draw calls 2 Answers
Used Textures stat.. what exactly does that mean ? 0 Answers
Lower Draw Calls For Sprites 2 Answers
Stuttering Game problem 1 Answer