用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:materialpropertyblock:materialpropertyblock

MaterialPropertyBlock 材质属性块

class in UnityEngine

Description 描述

A block of material values to apply.

应用材质值块。

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.

MateriaIPropcrtyBlock被Graphics.DrawMesh和Renderer.SetPropertyBlock使用。在你想绘制多个物体具有相同的材质时使用这个,但有稍微有些不同的属性。例如,如果你想稍微改变每个网络的颜色时。

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.

Unity的地形引擎使用MaterialPropertyBlock来绘制树;他们全部使用相同的材质,但是每棵树具有不同的颜色、缩放和受风力。

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 to add or replace values.

该材质块传递到Graphics.DrawMesh或Renderer.SetPropertyBlock被复制,因此使用它的最有效的方法是创建一个材质块并重用与所有的DrawMesh调用。使用SetFloat、SetVector、SetColor、SetMatrix、SetTexture来添加或替换值。

参见: Graphics.DrawMesh, Material.

Variables 变量

isEmptyIs the material property block empty? (Read Only)
该材质的属性块是否为空?(只读)

Public Functions 共有函数

ClearClear material property values.
清除材质属性值。
GetFloatGet a float from the property block.
从属性块获取浮点数。
GetMatrixGet a matrix from the property block.
获取该属性块的矩阵。
GetTextureGet a texture from the property block.
获取该属性块的纹理。
GetVectorGet a vector from the property block.
从该属性块获取向量。
SetColorSet a color property.
设置颜色属性。
SetFloatSet a float property.
设置一个浮点数属性。
SetMatrixSet a matrix property.
设置一个矩阵属性。
SetTextureSet a texture property.
设置一个纹理属性。
SetVectorSet a vector property.
设置一个向量属性。
script/unityengine/classes/materialpropertyblock/materialpropertyblock.txt · 最后更改: 2016/08/02 05:28 (外部编辑)