Material Property Blocks provide an efficient and compact method of changing certain properties of materials without need to duplicate said material.
For example, if one wishes to have the exact same material properties for many different objects spare the primary texture, a MainTexturePropertyBlock will provide such streamlined flexibility while also being more performant. Such performance increases are only significant when needing to render a huge amount of objects (on the order of hundreds)[1], but there is nonetheless no downside to using Material Property Blocks no matter the object count.[2]
General Usage
Every PropertyBlock component will have fields to override their respective fields on compatible materials. On a MeshRenderer orSkinnedMeshRenderer, there exists a MaterialPropertyBlocks
list. Placing a PropertyBlock component in this list will apply it to the material in the Materials
list.
Limitations
Property blocks are only able to be used on materials that implement its respective material property. For example, UnlitMaterial does not provide a _MainTex
property, so MainTexturePropertyBlock will have no effect on it. However, UI_UnlitMaterial provides this property.
Material Property Block Components
Components That Take In Material Property Block Components
References
- ↑ Mountainborn, Thomas. "Unity material animation using MaterialPropertyBlocks". Archived from the original on 30 March 2020.
- ↑ Geenz's Office Hours for 2023-11-08. Event occurs at 6:09.