MaterialPropertyBlock Manual     Reference     Scripting  
Scripting > Runtime Classes > MaterialPropertyBlock
MaterialPropertyBlock Class

A block of material values to apply.

MaterialPropertyBlock is used by Graphics.DrawMesh. Use it in situations where you want to draw multiple objects with the same material, but slightly different properties. For example, if you want to slightly change the color of each mesh drawn.

For performance reasons, the property block can contain only a limited number of property values. Two 4x4 matrices, six vectors/colors or 12 floats can be stored in the block. Storage space for the values is shared, so storing one matrix leaves twice less space to store vectors and floats.

Graphics.DrawMesh copies the passed property block, so the most efficient way of using it is to create one block and reuse it for all DrawMesh calls. Use Clear to clear block's values, and AddFloat, AddVector, AddColor, AddMatrix to add values.

See Also: Graphics.DrawMesh, Material.


Add a float material property.


Add a vector material property.


Add a color material property.


Add a matrix material property.


Clear material property values.