# SetTexture

> Set a texture property.

## Definition

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

## SetTexture(string, Texture)

Set a texture property.

```csharp
public void SetTexture(string name, Texture value)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.**** (\[Texture]\(/engine/6000.6/script-reference/unityengine/texture)): The [Texture](/engine/6000.6/script-reference/unityengine/texture.md) to set.

### Remarks

Adds a property to the block. If a texture property with the given name already exists, the old value is replaced.

By specifying a `RenderTextureSubElement`, you can indicate which type of data to set from the RenderTexture. The possible options are: [RenderTextureSubElement.Color](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/color.md), [RenderTextureSubElement.Depth](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/depth.md), and [RenderTextureSubElement.Stencil](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/stencil.md).

Additional Resources: [MaterialPropertyBlock.SetColor](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setcolor.md), [MaterialPropertyBlock.SetVector](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setvector.md), [MaterialPropertyBlock.SetFloat](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setfloat.md), [MaterialPropertyBlock.SetMatrix](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setmatrix.md), [RenderTextureSubElement](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement.md).

## SetTexture(int, Texture)

Set a texture property.

```csharp
public void SetTexture(int nameID, Texture value)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The name ID of the property retrieved by [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md).**** (\[Texture]\(/engine/6000.6/script-reference/unityengine/texture)): The [Texture](/engine/6000.6/script-reference/unityengine/texture.md) to set.

### Remarks

Adds a property to the block. If a texture property with the given name already exists, the old value is replaced.

By specifying a `RenderTextureSubElement`, you can indicate which type of data to set from the RenderTexture. The possible options are: [RenderTextureSubElement.Color](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/color.md), [RenderTextureSubElement.Depth](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/depth.md), and [RenderTextureSubElement.Stencil](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/stencil.md).

Additional Resources: [MaterialPropertyBlock.SetColor](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setcolor.md), [MaterialPropertyBlock.SetVector](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setvector.md), [MaterialPropertyBlock.SetFloat](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setfloat.md), [MaterialPropertyBlock.SetMatrix](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setmatrix.md), [RenderTextureSubElement](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement.md).

## SetTexture(string, RenderTexture, RenderTextureSubElement)

Set a texture property.

```csharp
public void SetTexture(string name, RenderTexture value, RenderTextureSubElement element)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.**** (\[RenderTexture]\(/engine/6000.6/script-reference/unityengine/rendertexture)): The [Texture](/engine/6000.6/script-reference/unityengine/texture.md) to set.**** (\[RenderTextureSubElement]\(/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement)): Optional parameter that specifies the type of data to set from the RenderTexture.

### Remarks

Adds a property to the block. If a texture property with the given name already exists, the old value is replaced.

By specifying a `RenderTextureSubElement`, you can indicate which type of data to set from the RenderTexture. The possible options are: [RenderTextureSubElement.Color](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/color.md), [RenderTextureSubElement.Depth](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/depth.md), and [RenderTextureSubElement.Stencil](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/stencil.md).

Additional Resources: [MaterialPropertyBlock.SetColor](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setcolor.md), [MaterialPropertyBlock.SetVector](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setvector.md), [MaterialPropertyBlock.SetFloat](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setfloat.md), [MaterialPropertyBlock.SetMatrix](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setmatrix.md), [RenderTextureSubElement](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement.md).

## SetTexture(int, RenderTexture, RenderTextureSubElement)

Set a texture property.

```csharp
public void SetTexture(int nameID, RenderTexture value, RenderTextureSubElement element)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The name ID of the property retrieved by [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md).**** (\[RenderTexture]\(/engine/6000.6/script-reference/unityengine/rendertexture)): The [Texture](/engine/6000.6/script-reference/unityengine/texture.md) to set.**** (\[RenderTextureSubElement]\(/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement)): Optional parameter that specifies the type of data to set from the RenderTexture.

### Remarks

Adds a property to the block. If a texture property with the given name already exists, the old value is replaced.

By specifying a `RenderTextureSubElement`, you can indicate which type of data to set from the RenderTexture. The possible options are: [RenderTextureSubElement.Color](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/color.md), [RenderTextureSubElement.Depth](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/depth.md), and [RenderTextureSubElement.Stencil](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement/stencil.md).

Additional Resources: [MaterialPropertyBlock.SetColor](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setcolor.md), [MaterialPropertyBlock.SetVector](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setvector.md), [MaterialPropertyBlock.SetFloat](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setfloat.md), [MaterialPropertyBlock.SetMatrix](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setmatrix.md), [RenderTextureSubElement](/engine/6000.6/script-reference/unityengine/rendering/rendertexturesubelement.md).
