要应用的材质值代码块。
MaterialPropertyBlock is used by Graphics.RenderMesh 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 的地形引擎使用 MaterialPropertyBlock 绘制树;它们全都使用
相同材质,但是每棵树具有不同的颜色、缩放和风力系数。
The block passed to Graphics.RenderMesh 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.
Note that this is not compatible with SRP Batcher. Using this in the Universal Render Pipeline (URP), High Definition Render Pipeline (HDRP) or a custom render pipeline based on the Scriptable Render Pipeline (SRP) will likely result in a drop in performance.
See Also: Graphics.RenderMesh, Material.
isEmpty | 材质属性代码块是否为空?(只读) |
Clear | 清除材质属性值。 |
CopyProbeOcclusionArrayFrom | 此函数将整个源数组都复制到名为 unity_ProbesOcclusion 的 Vector4 属性数组中,用于实例化 Shadowmask 渲染。 |
CopySHCoefficientArraysFrom | 此函数将整个源数组都转换并复制到名为 unity_SHBb、unity_SHBb、unity_SHBb、unity_SHBb、unity_SHBb、unity_SHBb 和 unity_SHC 的 7 个 Vector4 属性数组中,用于实例化light probe渲染。 |
GetColor | 从属性代码块获取颜色。 |
GetFloat | 从属性代码块获取浮点数。 |
GetFloatArray | 从属性代码块获取浮点数组。 |
GetInt | This method is deprecated. Use GetFloat or GetInteger instead. |
GetInteger | Get an integer from the property block. |
GetMatrix | 从属性代码块获取矩阵。 |
GetMatrixArray | 从属性代码块获取矩阵数组。 |
GetTexture | 从属性代码块获取纹理。 |
GetVector | 从属性代码块获取向量。 |
GetVectorArray | 从属性代码块获取向量数组。 |
HasBuffer | Checks if MaterialPropertyBlock has the ComputeBuffer property with the given name or name ID. To set the property, use SetBuffer. |
HasColor | Checks if MaterialPropertyBlock has the Color property with the given name or name ID. To set the property, use SetColor. |
HasConstantBuffer | Checks if MaterialPropertyBlock has the ConstantBuffer property with the given name or name ID. To set the property, use SetConstantBuffer. |
HasFloat | Checks if MaterialPropertyBlock has the Float property with the given name or name ID. To set the property, use SetFloat. |
HasInt | This method is deprecated. Use HasFloat or HasInteger instead. |
HasInteger | Checks if MaterialPropertyBlock has the Integer property with the given name or name ID. To set the property, use SetInteger. |
HasMatrix | Checks if MaterialPropertyBlock has the Matrix property with the given name or name ID. This also works with the Matrix Array property. To set the property, use SetMatrix. |
HasProperty | Checks if MaterialPropertyBlock has the property with the given name or name ID. To set the property, use one of the Set methods for MaterialPropertyBlock. |
HasTexture | Checks if MaterialPropertyBlock has the Texture property with the given name or name ID. To set the property, use SetTexture. |
HasVector | Checks if MaterialPropertyBlock has the Vector property with the given name or name ID. This also works with the Vector Array property. To set the property, use SetVector. |
SetBuffer | Set a buffer property. |
SetColor | 设置颜色属性。 |
SetConstantBuffer | Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the MaterialPropertyBlock. |
SetFloat | 设置浮点属性。 |
SetFloatArray | 设置浮点数组属性。 |
SetInt | This method is deprecated. Use SetFloat or SetInteger instead. |
SetInteger | Adds a property to the block. If an integer property with the given name already exists, the old value is replaced. |
SetMatrix | 设置矩阵属性。 |
SetMatrixArray | 设置矩阵数组属性。 |
SetTexture | 设置纹理属性。 |
SetVector | 设置向量属性。 |
SetVectorArray | 设置向量数组属性。 |