Version: 5.4
public void SetTexture (string propertyName, Texture texture);
public void SetTexture (int nameID, Texture texture);

Parámetros

propertyName Nombre de propiedad e.g. "_MainTex".
nameID Nombre del ID de la propiedad, utilice Shader.PropertyToID para obtenerla.
texture Texture to set.

Descripción

Establece una textura nombrada.

Muchos shaders utilizan más de una textura. Utilice SetTexture para cambiar la textura (identificada por la propiedad shader name, o propiedad única name ID).

Al configurar texturas en materiales utilizando el Shader estándar, debe tener en cuenta que puede ser necesario utilizar EnableKeyword para habilitar las características del shader que no estaban en uso anteriormente. Para más detalles, lea 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.

See Also: mainTexture property, GetTexture, Shader.PropertyToID, Properties in Shader Programs.