# SetTextureScale

> Sets the placement scale of texture propertyName.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## SetTextureScale(string, Vector2)

Sets the placement scale of texture `propertyName`.

```csharp
public void SetTextureScale(string name, Vector2 value)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Property name, e.g. "\_MainTex".**** (\[Vector2]\(/engine/6000.7/script-reference/unityengine/vector2)): Texture placement scale.

### Remarks

Additional Resources: [Material.mainTextureScale](/engine/6000.7/script-reference/unityengine/material/maintexturescale.md) property, [Material.GetTextureScale](/engine/6000.7/script-reference/unityengine/material/gettexturescale.md), [Material.SetTexture](/engine/6000.7/script-reference/unityengine/material/settexture.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    // Scroll main texture based on time

    float scrollSpeed = 0.5f;
    Renderer rend;

    void Start()
    {
        rend = GetComponent<Renderer> ();
    }

    void Update()
    {
        // Animates main texture scale in a funky way!
        float scaleX = Mathf.Cos(Time.time) * 0.5f + 1;
        float scaleY = Mathf.Sin(Time.time) * 0.5f + 1;
        rend.material.SetTextureScale("_MainTex", new Vector2(scaleX, scaleY));
    }
}
```

## SetTextureScale(int, Vector2)

Sets the placement scale of texture `propertyName`.

```csharp
public void SetTextureScale(int nameID, Vector2 value)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Property name ID, use [Shader.PropertyToID](/engine/6000.7/script-reference/unityengine/shader/propertytoid.md) to get it.**** (\[Vector2]\(/engine/6000.7/script-reference/unityengine/vector2)): Texture placement scale.

### Remarks

Additional Resources: [Material.mainTextureScale](/engine/6000.7/script-reference/unityengine/material/maintexturescale.md) property, [Material.GetTextureScale](/engine/6000.7/script-reference/unityengine/material/gettexturescale.md), [Material.SetTexture](/engine/6000.7/script-reference/unityengine/material/settexture.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    // Scroll main texture based on time

    float scrollSpeed = 0.5f;
    Renderer rend;

    void Start()
    {
        rend = GetComponent<Renderer> ();
    }

    void Update()
    {
        // Animates main texture scale in a funky way!
        float scaleX = Mathf.Cos(Time.time) * 0.5f + 1;
        float scaleY = Mathf.Sin(Time.time) * 0.5f + 1;
        rend.material.SetTextureScale("_MainTex", new Vector2(scaleX, scaleY));
    }
}
```
