MaterialPropertyBlock Manual     Reference     Scripting  
Scripting > Runtime Classes > MaterialPropertyBlock
MaterialPropertyBlock

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.

Unity's terrain engine uses MaterialPropertyBlock to draw trees; all of them use the same material, but each tree has different color, scale & wind factor.

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.

Functions
AddFloat

Add a float material property.

AddVector

Add a vector material property.

AddColor

Add a color material property.

AddMatrix

Add a matrix material property.

Clear

Clear material property values.