Material.GetColor 获取颜色

function GetColor (propertyName : string) : Color

Description描述

Get a named color value.

获取已命名的颜色值

Many shaders use more than one color. Use GetColor to get the propertyName color.

许多着色器使用超过一种颜色。使用 GetColor 来获得 propertyName颜色。

Common color names used by Unity's builtin shaders:
Unity内置着色器使用的共同的颜色名称:

"_Color" is the main color of a material. This can also be accessed via color property.
“_Color”是材质的主颜色,也可以通过 color 属性访问。

"_SpecColor" is the specular color of a material (used in specular/glossy/vertexlit shaders).
"_SpecColor"是材质的高光颜色(使用在specular/glossy/vertexlit 着色器上)

"_Emission" is the emissive color of a material (used in vertexlit shaders).
"_Emission"是材质的散射色(使用在vertexlit着色器上)

"_ReflectColor" is the reflection color of the material (used in reflective shaders).
"_ReflectColor"是材质的反射颜色(使用在reflective着色器上)

参见: color 属性,SetColor.

print (renderer.material.GetColor("_SpecColor"));
Page last updated: 2011-1-22