Class for ProceduralMaterial handling.
A reference to a ProceduralMaterial is usually assigned using "renderer.sharedMaterial as ProceduralMaterial".
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 (); } }
using UnityEngine; using System.Collections; public class ExampleClass : 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); substance.RebuildTextures(); } } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): public floatRangeProperty as string = 'Saturation' public cycleTime as float = 10 def Update() as void: substance as ProceduralMaterial = (renderer.sharedMaterial as ProceduralMaterial) if substance: lerp as float = Mathf.PingPong(((Time.time * 2) / cycleTime), 1) substance.SetProceduralFloat(floatRangeProperty, lerp) substance.RebuildTextures()
Note that accessing a ProceduralMaterial via renderer.material will create a runtime clone of the original ProceduralMaterial and can negatively impact performance.
| isSupported | 今のプラットフォームでサポートされているかを確認する |
| substanceProcessorUsage | CPUの使用率を指定するために使用する |
| animationUpdateRate | アニメーションの更新レートを設定/取得する |
| cacheSize | キャッシュバジェットを設定/取得する |
| isCachedDataAvailable | Indicates whether cached data is available for this ProceduralMaterial's textures (only relevant for Cache and DoNothingAndCache loading behaviors). |
| isLoadTimeGenerated | ロード時に生成されるべきかを判断する |
| isProcessing | テクスチャの再レンダリング中に、Procedural<aterialオブジェクト |
| 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 | 指定した名前のプロパティをキャッシュするかを設定します |
| ClearCache | プロシージャル キャッシュをクリアします |
| GetGeneratedTexture | ProceduralMaterial により生成された ProceduralTexture への参照を、ProceduralTexture の名前を使用して取得できます |
| GetGeneratedTextures | 生成されたテクスチャを取得します |
| GetProceduralBoolean | プロパティ名を指定してBoolean型のプロパティを取得します |
| GetProceduralColor | プロパティ名を指定してColor型のプロパティを取得します |
| GetProceduralEnum | プロパティ名を指定してEnum型のプロパティを取得する |
| GetProceduralFloat | プロパティ名を指定してFloat型のプロパティを取得します |
| GetProceduralPropertyDescriptions | Get an array of descriptions of all the ProceduralProperties this ProceduralMaterial has. |
| GetProceduralTexture | プロパティ名を指定してTexture2D型のプロパティを取得する |
| GetProceduralVector | プロパティ名を指定してVector型のプロパティを取得する |
| HasProceduralProperty | 指定した名前のProceduralPropertyがあるか確認します |
| IsProceduralPropertyCached | 指定した名前のプロパティがキャッシュされているかを確認する |
| RebuildTextures | Triggers an asynchronous rebuild of this ProceduralMaterial's dirty textures. |
| RebuildTexturesImmediately | Triggers an immediate (synchronous) rebuild of this ProceduralMaterial's dirty textures. |
| SetProceduralBoolean | プロパティ名を指定してBoolean型のプロパティを設定する |
| SetProceduralColor | プロパティ名を指定してColor型のプロパティを設定する |
| SetProceduralEnum | プロパティ名を指定してEnum型のプロパティを設定する |
| SetProceduralFloat | プロパティ名を指定してFloat型のプロパティを設定する |
| SetProceduralTexture | プロパティ名を指定してTexture2D型のプロパティを設定する |
| SetProceduralVector | プロパティ名を指定してVector型のプロパティを設定する |
| StopRebuilds | Discard all the queued ProceduralMaterial rendering operations that have not started yet. |
| color | マテリアルの色 |
| mainTexture | マテリアルのテクスチャ |
| mainTextureOffset | メインテクスチャのオフセット |
| mainTextureScale | メインテクスチャのスケール |
| passCount | マテリアルのパスの数 (Read Only) |
| renderQueue | マテリアルのレンダーキュー |
| shader | マテリアルで使用するシェーダー |
| shaderKeywords | マテリアルに設定される追加シェーダキーワード |
| hideFlags | オブジェクトは非表示、シーンに保存、ユーザーが編集可能などを行うかどうか |
| name | オブジェクト名 |
| CopyPropertiesFromMaterial | マテリアルのプロパティを他のマテリアルにコピーします |
| DisableKeyword | セットしたシェーダ キーワードを取り消します |
| EnableKeyword | マテリアルにより有効化されるシェーダ キーワードを設定します |
| GetColor | 設定された名前から色を取得します |
| GetFloat | 設定された名前からfloat値を取得します |
| GetInt | 設定された名前からint値を取得します |
| GetMatrix | 設定された名前からmatrix値を取得します |
| GetTag | マテリアルのシェーダーのタグ名を取得します |
| GetTexture | 設定された名前からテクスチャを取得します |
| GetTextureOffset | テクスチャのプロパティ名から画像のオフセットを取得します |
| GetTextureScale | テクスチャのプロパティ名から画像の大きさを取得します |
| GetVector | プロパティ名からVector4型の値を取得します |
| HasProperty | シェーダーのプロパティに特定のプロパティ名が設定されているか確認します |
| Lerp | 2つのマテリアルを時間をかけて変更させます |
| SetBuffer | ComputeBufferを設定します |
| SetColor | 色を設定します |
| SetFloat | float値を設定します |
| SetInt | int値を設定します |
| SetMatrix | matrix値を設定します |
| SetPass | レンダリングのための特定のパスを有効にします |
| SetTexture | テクスチャを設定します |
| SetTextureOffset | テクスチャのオフセットを設定します |
| SetTextureScale | テクスチャのスケールを設定します |
| SetVector | Vector値を設定します |
| GetInstanceID | Returns the instance id of the object. |
| ToString | ゲームオブジェクトの名前を返します |
| Destroy | ゲームオブジェクト、コンポーネントやアセットを削除します |
| DestroyImmediate | 直ちにオブジェクトを破壊する。ですが、Destroy関数の方を使うことを推奨します |
| DontDestroyOnLoad | 新しいシーンを読み込んでもオブジェクトが自動で破壊されないように設定します |
| FindObjectOfType | タイプから最初に見つけたアクティブのオブジェクトを返します |
| FindObjectsOfType | タイプから見つけた全てのアクティブのオブジェクト配列を返します |
| Instantiate | original のオブジェクトをクローンします |
| bool | オブジェクトが存在するかどうか |
| operator != | 二つのオブジェクトが異なるオブジェクトを参照しているか比較します |
| operator == | 二つのオブジェクトが同じオブジェクトを参照しているか比較します |