Class for ProceduralMaterial handling.
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 substance = rend.sharedMaterial as ProceduralMaterial; if (substance) { float lerp = Mathf.PingPong(Time.time * 2 / cycleTime, 1); substance.SetProceduralFloat(floatRangeProperty, lerp); substance.RebuildTextures(); } } }
isSupported | Check if ProceduralMaterials are supported on the current platform. |
substanceProcessorUsage | Used to specify the Substance engine CPU usage. |
animationUpdateRate | Set or get the update rate in millisecond of the animated substance. |
cacheSize | Set or get the Procedural cache budget. |
isCachedDataAvailable | Indicates whether cached data is available for this ProceduralMaterial's textures (only relevant for Cache and DoNothingAndCache loading behaviors). |
isFrozen | Returns true if FreezeAndReleaseSourceData was called on this ProceduralMaterial. |
isLoadTimeGenerated | Should the ProceduralMaterial be generated at load time? |
isProcessing | Check if the ProceduralTextures from this ProceduralMaterial are currently being rebuilt. |
isReadable | Set or get the "Readable" flag for a ProceduralMaterial. |
loadingBehavior | Get ProceduralMaterial loading behavior. |
preset | Set or get an XML string of "input/value" pairs (setting the preset rebuilds the textures). |
CacheProceduralProperty | Specifies if a named ProceduralProperty should be cached for efficient runtime tweaking. |
ClearCache | Clear the Procedural cache. |
FreezeAndReleaseSourceData | Render a ProceduralMaterial immutable and release the underlying data to decrease the memory footprint. |
GetGeneratedTexture | This allows to get a reference to a ProceduralTexture generated by a ProceduralMaterial using its name. |
GetGeneratedTextures | Get generated textures. |
GetProceduralBoolean | Get a named Procedural boolean property. |
GetProceduralColor | Get a named Procedural color property. |
GetProceduralEnum | Get a named Procedural enum property. |
GetProceduralFloat | Get a named Procedural float property. |
GetProceduralPropertyDescriptions | Get an array of descriptions of all the ProceduralProperties this ProceduralMaterial has. |
GetProceduralString | Get a named Procedural string property. |
GetProceduralTexture | Get a named Procedural texture property. |
GetProceduralVector | Get a named Procedural vector property. |
HasProceduralProperty | Checks if the ProceduralMaterial has a ProceduralProperty of a given name. |
IsProceduralPropertyCached | Checks if a named ProceduralProperty is cached for efficient runtime tweaking. |
IsProceduralPropertyVisible | Checks if a given ProceduralProperty is visible according to the values of this ProceduralMaterial's other ProceduralProperties and to the ProceduralProperty's visibleIf expression. |
RebuildTextures | Triggers an asynchronous rebuild of this ProceduralMaterial's dirty textures. |
RebuildTexturesImmediately | 触发此 ProceduralMaterial 的脏纹理的立即(同步)重新构建。 |
SetProceduralBoolean | Set a named Procedural boolean property. |
SetProceduralColor | Set a named Procedural color property. |
SetProceduralEnum | Set a named Procedural enum property. |
SetProceduralFloat | Set a named Procedural float property. |
SetProceduralString | Set a named Procedural string property. |
SetProceduralTexture | Set a named Procedural texture property. |
SetProceduralVector | Set a named Procedural vector property. |
StopRebuilds | Discard all the queued ProceduralMaterial rendering operations that have not started yet. |
color | 主材质的颜色。 |
doubleSidedGI | 获取和设置是否为此材质启用双面全局光照设置。 |
enableInstancing | 获取和设置是否为此材质启用 GPU 实例化。 |
globalIlluminationFlags | 定义材质应如何与光照贴图和光照探针交互。 |
mainTexture | 材质的纹理。 |
mainTextureOffset | 主纹理的纹理偏移。 |
mainTextureScale | 主纹理的纹理缩放。 |
passCount | 此材质中的通道数(只读)。 |
renderQueue | 此材质的渲染队列。 |
shader | 材质使用的着色器。 |
shaderKeywords | 此材质设置的附加着色器关键字。 |
hideFlags | 该对象应该隐藏、随场景一起保存还是由用户修改? |
name | 对象的名称。 |
CopyPropertiesFromMaterial | 将属性从其他材质复制到此材质中。 |
DisableKeyword | 取消设置着色器关键字。 |
EnableKeyword | 设置此材质启用的着色器关键字。 |
FindPass | 返回通道 passName 的索引。 |
GetColor | 获取指定的颜色值。 |
GetColorArray | 获取指定的颜色数组。 |
GetFloat | 获取指定的浮点值。 |
GetFloatArray | 获取指定的浮点数组。 |
GetInt | 获取指定的整数值。 |
GetMatrix | 从着色器获取指定的矩阵值。 |
GetMatrixArray | 获取指定的矩阵数组。 |
GetPassName | 返回索引 pass 处的着色器通道的名称。 |
GetShaderPassEnabled | 检查此材质上是否启用了给定的着色器通道。 |
GetTag | 获取材质着色器标记的值。 |
GetTexture | 获取指定的纹理。 |
GetTextureOffset | 获取纹理 propertyName 的位置偏移。 |
GetTextureScale | 获取纹理 propertyName 的位置缩放。 |
GetVector | 获取指定的向量值。 |
GetVectorArray | 获取指定的向量数组。 |
HasProperty | 检查材质的着色器是否具有给定名称的属性。 |
IsKeywordEnabled | 此材质上是否启用了着色器关键字? |
Lerp | 在两个材质之间对属性进行插值。 |
SetBuffer | 设置指定的 ComputeBuffer 值。 |
SetColor | 设置指定的颜色值。 |
SetColorArray | 设置颜色数组属性。 |
SetFloat | 设置指定的浮点值。 |
SetFloatArray | 设置浮点数组属性。 |
SetInt | 设置指定的整数值。 |
SetMatrix | 为着色器设置指定的矩阵。 |
SetMatrixArray | 设置矩阵数组属性。 |
SetOverrideTag | 对材质设置重写标记/值。 |
SetPass | 激活给定的 pass 以进行渲染。 |
SetShaderPassEnabled | 在每个材质级别上启用或禁用着色器通道。 |
SetTexture | 设置指定的纹理。 |
SetTextureOffset | 设置纹理 propertyName 的位置偏移。 |
SetTextureScale | 设置纹理 propertyName 的位置缩放。 |
SetVector | 设置指定的向量值。 |
SetVectorArray | 设置向量数组属性。 |
GetInstanceID | 返回对象的实例 ID。 |
ToString | Returns the name of the game object. |
Destroy | 删除 GameObject、组件或资源。 |
DestroyImmediate | 立即销毁对象 /obj/。强烈建议您改用 Destroy。 |
DontDestroyOnLoad | 加载新场景时,不自动销毁对象 /target/。 |
FindObjectOfType | 返回第一个类型为 type 的已加载的激活对象。 |
FindObjectsOfType | 返回所有类型为 type 的已加载的激活对象的列表。 |
Instantiate | 克隆 original 对象并返回克隆对象。 |
bool | 该对象是否存在? |
operator != | 比较两个对象是否引用不同的对象。 |
operator == | 比较两个对象引用,判断它们是否引用同一个对象。 |