ProceduralMaterial 程序材质

Inherits from Material

ProceduralMaterial class.


This class exposes all properties from a Procedural Material, allowing you to modify or animate them. In order to get a Procedural Material used by an object, use the Renderer.material as a ProceduralMaterial. After modifying one or more procedural properties, call RebuildTextures to update the Procedural Material to show the changes.


using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public string floatRangeProperty = "Saturation";
	public float cycleTime = 10;
	void Update() {
		ProceduralMaterial substance = renderer.sharedMaterial as ProceduralMaterial;
		if (substance) {
			float lerp = Mathf.PingPong(Time.time * 2 / cycleTime, 1);
			substance.SetProceduralFloat(floatRangeProperty, lerp);
var floatRangeProperty : String = "Saturation";
var cycleTime : float = 10;

function Update () {
	var substance : ProceduralMaterial = renderer.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 ();




Class Variables类变量

Class Functions类函数

Inherited members继承成员

Inherited Variables继承变量

Inherited Constructors继承构造器

Inherited Functions继承函数

Inherited Class Functions继承类函数

Page last updated: 2011-9-13