Material材质 翻译:titan-志广
- 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.HasProperty 是否有属性
function HasProperty (propertyName : string) : bool
Description描述
Checks if material's shader has a property of a given name.
检查材质的着色器是否具有给定名称的属性
参见: Materials
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public void Awake() {
if (renderer.material.HasProperty("_Color"))
renderer.material.SetColor("_Color", Color.red);
}
}
// Attach this to a gameObject that has a renderer.
//把它附加在有renderer组件的游戏物体(gameobject)上
if(renderer.material.HasProperty("_Color"))
renderer.material.SetColor("_Color", Color.red );
最后修改:2011年1月22日 Saturday 22:00