how do i change the tiling x and y from .js script for a texture..Thx!

how do i change the tiling x and y from .js script for a texture..Thx!

Peter

By using Material.mainTextureScale. Here's the example provided in the docs:

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.mainTextureScale = Vector2 (scaleX,scaleY);
}

Also, you need to ensure that the wrap mode of your material's texture is set to 'repeat' and not 'clamp'. (it is set to repeat by default).

You can also use:

SetTextureScale and SetTextureOffset

This way you can edit also bump and others maps.

thanks a lot ! nice help