お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Close設定された名前からテクスチャを取得します
多くのシェーダでは複数のテクスチャを使用します。GetTexture によりプロパティ名( propertyName
)からテクスチャを取得します。
Unityのビルトインシェーダーでは、テクスチャを設定するプロパティ名は3 つあります:
"_MainTex"
メインとなるテクスチャ。 mainTextureでも設定できます。
"_BumpMap"
ノーマルマップ
"_Cube"
リフレクションキューブマップ
See Also: mainTexture property, SetTexture, Shader.PropertyToID.
function Start () { var tex : Texture = renderer.material.GetTexture ("_BumpMap"); if (tex) print ("My bumpmap is " + tex.name); else print ("I have no bumpmap!"); }