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.shader 着色器
var shader : Shader
Description描述
The shader used by the material.
材质使用的着色器。
参考: Shader.Find 方法, Materials
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Shader shader1 = Shader.Find("Diffuse");
public Shader shader2 = Shader.Find("Transparent/Diffuse");
void Update() {
if (Input.GetButtonDown("Jump"))
if (renderer.material.shader == shader1)
renderer.material.shader = shader2;
else
renderer.material.shader = shader1;
}
}
// Toggle between Diffuse and Transparent/Diffuse shaders
// when space key is pressed
//当按下空格键,漫反射透明和漫反射间的切换
var shader1 : Shader = Shader.Find( "Diffuse" );
var shader2 : Shader = Shader.Find( "Transparent/Diffuse" );
function Update() {
if( Input.GetButtonDown("Jump") ) {
if( renderer.material.shader == shader1 )
renderer.material.shader = shader2;
else
renderer.material.shader = shader1;
}
}
最后修改:2011年5月9日 Monday 10:58