Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetPropertyBlock

Get per-Renderer or per-Material property block.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

GetPropertyBlock(MaterialPropertyBlock)

Get per-Renderer or per-Material property block.
public void GetPropertyBlock(MaterialPropertyBlock properties)

Parameters

Material parameters to retrieve.

Remarks

The retrieved properties are stored in the property block passed in through "properties". If no properties are set, the property block is cleared. In either case the property block you pass in is completely overwritten.
If you provide a Material index, only the parameters of that Material are retrieved.

GetPropertyBlock(MaterialPropertyBlock, int)

Get per-Renderer or per-Material property block.
public void GetPropertyBlock(MaterialPropertyBlock properties, int materialIndex)

Parameters

Material parameters to retrieve.

materialIndex

The index of the Material you want to get overridden parameters from. The index ranges from 0 to Renderer.sharedMaterials.Length-1.

Remarks

The retrieved properties are stored in the property block passed in through "properties". If no properties are set, the property block is cleared. In either case the property block you pass in is completely overwritten.
If you provide a Material index, only the parameters of that Material are retrieved.