- color
- CopyPropertiesFromMaterial
- GetColor
- GetFloat
- GetMatrix
- GetTag
- GetTextureOffset
- GetTextureScale
- GetTexture
- GetVector
- HasProperty
- Lerp
- mainTextureOffset
- mainTextureScale
- mainTexture
- Material
- passCount
- renderQueue
- SetColor
- SetFloat
- SetMatrix
- SetPass
- SetTextureOffset
- SetTextureScale
- SetTexture
- SetVector
- shader
Material.SetColor 设置颜色
function SetColor (propertyName : string, color : Color) : void
Description描述
Set a named color value.
设置已命名的颜色值
Many shaders use more than one color. Use SetColor to change the propertyName color.
许多着色器使用超过一种颜色。使用 SetColor 来更改 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着色器上)
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Start() {
renderer.material.shader = Shader.Find(" Glossy");
renderer.material.SetColor("_SpecColor", Color.red);
}
}
function Start () {
// Set glossy shader so that specular color is used
//设置glossy着色器以便使用高光颜色
renderer.material.shader = Shader.Find (" Glossy");
// Set red specular highlights
//设置高光色为红色
renderer.material.SetColor ("_SpecColor", Color.red );
}