I'm trying to optimize my drawcalls on an iPhone project, and it's my understanding that changing the material color generates a new material instance and hence another drawcall.
I read in the forums that using a VertexLit shader and modifying vertex colors will let you change the color of an object and still keep it dynamically batched.
I don't know much about shaders, but in my code I am modifying the "material.color" property, thinking thats how you change the Vertex colors. It's still creating a new material though, so I must be doing something wrong.
So given two objects that share the same material, object A and object B. How can I make: A = red B = blue and still keep batching?
here is a code snippet of how i'm currently doing it
asked Apr 24 '10 at 12:19 PM
You could render them with individual colors in one batch using Graphics.DrawMesh and MaterialPropertyBlock: http://unity3d.com/support/documentation/ScriptReference/MaterialPropertyBlock.html
answered May 26 '10 at 07:29 PM