Material.SetTextureScale Manual     Reference     Scripting  
Scripting > Runtime Classes > Material

function SetTextureScale (propertyName : string, scale : Vector2) : void


Sets the placement scale of texture propertyName.

Common texture names used by Unity's builtin shaders:
"_MainTex" is the main diffuse texture. This can also be accessed via mainTextureScale property.
"_BumpMap" is the normal map.
"_LightMap" is the lightmap texture.
"_Cube" is the reflection cubemap.

See Also: mainTextureScale property, GetTextureScale.

function Update ()
// Animates main texture scale in a funky way!
var scaleX = Mathf.Cos (Time.time) * 0.5 + 1;
var scaleY = Mathf.Sin (Time.time) * 0.5 + 1;
renderer.material.SetTextureScale ("_MainTex", Vector2(scaleX,scaleY));