Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Material.SetTexture

マニュアルに切り替える
public void SetTexture(string propertyName, Texture texture);
public void SetTexture(int nameID, Texture texture);

パラメーター

説明

テクスチャを設定します

多くのシェーダーでは複数のテクスチャを使用します。SetTexture によりプロパティー名( propertyName )からテクスチャを設定します。

標準シェーダーを使用しているマテリアルのテクスチャを設定するとき、以前使用していないシェーダーの機能を有効にするために EnableKeyword を使用する必要があることに注意しなければなりません。詳細については Accessing Materials via Script を参照してください。

Common texture names used by Unity's builtin shaders:
"_MainTex" is the main diffuse texture. This can also be accessed via mainTexture property.
"_BumpMap" is the normal map.
"_Cube" リフレクションキューブマップ

See Also: mainTexture property, GetTexture, Shader.PropertyToID.