Material.SetFloat 设置浮点数

function SetFloat (propertyName : string, value : float) : void

Description描述

Set a named float value.

设置一个命名的浮点数

参见: GetFloat , Materials

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		renderer.material.shader = Shader.Find(" Glossy");
	}
	void Update() {
		float shininess = Mathf.PingPong(Time.time, 1.0F);
		renderer.material.SetFloat("_Shininess", shininess);
	}
}

function Start () {
	// Use the Glossy shader on the material
	//材质使用Glossy 着色器
	renderer.material.shader = Shader.Find (" Glossy");
}

function Update () {
	// Animate the Shininess value
	//动画反光度数值
	var shininess : float = Mathf.PingPong ( Time.time , 1.0);
	renderer.material.SetFloat( "_Shininess", shininess );
}
Page last updated: 2011-1-22