Skip to main content

MaterialPropertyBlock

A block of material values to apply. Unity MaterialPropertyBlock

Members

Properties

NameDescription
MaterialPropertyBlock.isEmptyIs the material property block empty? (Read Only)

Constructor

NameDescription
MaterialPropertyBlock()Create an empty MaterialPropertyBlock.

Methods

NameDescription
MaterialPropertyBlock.Clear()Clear material property values.
MaterialPropertyBlock.CopyProbeOcclusionArrayFrom(cclusionProbes[])This function copies the entire source array into a Vector4 property array named unity_ProbesOcclusion for use with instanced Shadowmask rendering.
MaterialPropertyBlock.CopySHCoefficientArraysFrom(lightProbes[])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.
MaterialPropertyBlock.GetColor(name)Get a color from the property block.
MaterialPropertyBlock.GetFloat(name)Get a float from the property block.
MaterialPropertyBlock.GetFloatArray(name)Get a float array from the property block.
MaterialPropertyBlock.GetInt(name)Get an int from the property block.
MaterialPropertyBlock.GetMatrix(name)Get a matrix from the property block.
MaterialPropertyBlock.GetMatrixArray(name)Get a matrix array from the property block.
MaterialPropertyBlock.GetTexture(name)Get a texture from the property block.
MaterialPropertyBlock.GetVector(name)Get a vector from the property block.
MaterialPropertyBlock.GetVectorArray(name)Get a vector array from the property block.
MaterialPropertyBlock.SetColor(name, value)Set a color property.
MaterialPropertyBlock.SetFloat(name, value)Set a float property.
MaterialPropertyBlock.SetFloatArray(name, values[])Set a float array property.
MaterialPropertyBlock.SetInt(name, value)Adds a property to the block. If an int property with the given name already exists, the old value is replaced.
MaterialPropertyBlock.SetMatrix(name, value)Set a matrix property.
MaterialPropertyBlock.SetMatrixArray(name, values[])Set a matrix array property.
MaterialPropertyBlock.SetTexture(name, value)Set a texture property.
MaterialPropertyBlock.SetVector(name, value)Set a vector property.
MaterialPropertyBlock.SetVectorArray(name, values[])Set a vector array property.

Extra Detail

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.