Skip to content

API > MaterialPropertyBlock


MaterialPropertyBlock⚓︎

A block of material values to apply. Unity MaterialPropertyBlock

Members⚓︎

Properties⚓︎

Name Description
MaterialPropertyBlock.isEmptyProperty Is the material property block empty? (Read Only)

Constructor⚓︎

Name Description
MaterialPropertyBlock()Constructor Create an empty MaterialPropertyBlock.

Methods⚓︎

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