Version: 2021.1

MaterialPropertyBlock

class in UnityEngine

マニュアルに切り替える

説明

マテリアル情報を適用するブロック要素を作成します。

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.

Unity's terrain engine uses MaterialPropertyBlock to draw trees; all of them use the same material, but each tree has different color, scale & wind factor.

The block passed to Graphics.DrawMesh 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.

See Also: Graphics.DrawMesh, Material.

変数

isEmptyMaterialPropertyBlock が空かどうか (読み込み専用)

Public 関数

Clear設定したマテリアルプロパティーをすべて削除します。
CopyProbeOcclusionArrayFromThis function copies the entire source array into a Vector4 property array named unity_ProbesOcclusion for use with instanced Shadowmask rendering.
CopySHCoefficientArraysFromThis 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.
GetColorGet a color from the property block.
GetFloatプロパティーブロックから float を取得します
GetFloatArrayGet a float array from the property block.
GetIntThis method is deprecated. Use GetFloat or GetInteger instead.
GetIntegerGet an integer from the property block.
GetMatrixプロパティーブロックから matrix を取得します
GetMatrixArrayGet a matrix array from the property block.
GetTextureプロパティーブロックから texture を取得します
GetVectorプロパティーブロックから vector を取得します。
GetVectorArrayGet a vector array from the property block.
HasBufferChecks if MaterialPropertyBlock has the ComputeBuffer property with the given name or name ID. To set the property, use SetBuffer.
HasColorChecks if MaterialPropertyBlock has the Color property with the given name or name ID. To set the property, use SetColor.
HasConstantBufferChecks if MaterialPropertyBlock has the ConstantBuffer property with the given name or name ID. To set the property, use SetConstantBuffer.
HasFloatChecks if MaterialPropertyBlock has the Float property with the given name or name ID. To set the property, use SetFloat.
HasIntThis method is deprecated. Use HasFloat or HasInteger instead.
HasIntegerChecks if MaterialPropertyBlock has the Integer property with the given name or name ID. To set the property, use SetInteger.
HasMatrixChecks 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.
HasPropertyChecks if MaterialPropertyBlock has the property with the given name or name ID. To set the property, use one of the Set methods for MaterialPropertyBlock.
HasTextureChecks if MaterialPropertyBlock has the Texture property with the given name or name ID. To set the property, use SetTexture.
HasVectorChecks 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.
SetBufferSet a buffer property.
SetColorcolor 型のプロパティーを設定します
SetConstantBufferSets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the MaterialPropertyBlock.
SetFloatfloat 型のプロパティーを設定します
SetFloatArrayfloat 配列のプロパティーを設定します。
SetIntThis method is deprecated. Use SetFloat or SetInteger instead.
SetIntegerAdds a property to the block. If an integer property with the given name already exists, the old value is replaced.
SetMatrixMatrix4x4 型のプロパティーを設定します
SetMatrixArrayMatrix 配列プロパティーを設定します。
SetTextureTexture 型のプロパティーを設定します
SetVectorvector 型のプロパティーを設定します
SetVectorArrayベクトル配列プロパティーを設定します。