Material.GetColor 获取颜色

function GetColor (propertyName : string) : Color


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:

"_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).

"_ReflectColor" is the reflection color of the material (used in reflective shaders).

参见: color 属性,SetColor.

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