用户工具

站点工具


侧边栏

script:unityengine:classes:proceduralmaterial:proceduralmaterial

ProceduralMaterial 程序材质

class in UnityEngine/Inherits from: Material

Description 描述

Class for ProceduralMaterial handling.

程序材质处理的类。

JavaScript:

var floatRangeProperty : String = "Saturation";
var cycleTime : float = 10;
var rend: Renderer;
 
 
function Start() {
	rend = GetComponent.<Renderer>();
}
 
 
function Update () {
	var substance : ProceduralMaterial = rend.sharedMaterial as ProceduralMaterial;
 
	if (substance) {
		// Make the property go up and down over time
		var lerp = Mathf.PingPong (Time.time * 2 / cycleTime, 1);
		substance.SetProceduralFloat (floatRangeProperty, lerp);
		substance.RebuildTextures ();
	}
}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    public string floatRangeProperty = "Saturation";
    public float cycleTime = 10;
    public Renderer rend;
    void Start() {
        rend = GetComponent<Renderer>();
    }
    void Update() {
        ProceduralMaterial substanc
                    
                                    
script/unityengine/classes/proceduralmaterial/proceduralmaterial.txt · 最后更改: 2016/08/02 05:32 (外部编辑)