A block of material values to apply.
MaterialPropertyBlock is used by Graphics.DrawMesh and Renderer.SetPropertyBlock. 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. Changing the render state is not supported.
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.
The block passed to Graphics.DrawMesh or Renderer.SetPropertyBlock is copied, so the most efficient way of using it is
to create one block and reuse it for all DrawMesh calls. Use SetFloat, SetVector, SetColor, SetMatrix, SetTexture, SetBuffer to add or replace values.
See Also: Graphics.DrawMesh, Material.
isEmpty | Is the material property block empty? (Read Only) |
Clear | Clear material property values. |
CopyProbeOcclusionArrayFrom | This function copies the entire source array into a Vector4 property array named unity_ProbesOcclusion for use with instanced Shadowmask rendering. |
CopySHCoefficientArraysFrom | This function converts and copies the entire source array into 7 Vector4 property arrays named unity_SHAr, unity_SHAg, unity_SHAb, unity_SHBr, unity_SHBg, unity_SHBb and unity_SHC for use with instanced light probe rendering. |
GetColor | Get a color from the property block. |
GetFloat | Get a float from the property block. |
GetFloatArray | Get a float array from the property block. |
GetMatrix | Get a matrix from the property block. |
GetMatrixArray | Get a matrix array from the property block. |
GetTexture | Get a texture from the property block. |
GetVector | Get a vector from the property block. |
GetVectorArray | Get a vector array from the property block. |
SetBuffer | Set a ComputeBuffer property. |
SetColor | Set a color property. |
SetFloat | Set a float property. |
SetFloatArray | Set a float array property. |
SetMatrix | Set a matrix property. |
SetMatrixArray | Set a matrix array property. |
SetTexture | Set a texture property. |
SetVector | Set a vector property. |
SetVectorArray | Set a vector array property. |
Did you find this page useful? Please give it a rating: