# SetTexture(Texture2D, int)

> Assign a texture to the specified layer.

## Definition

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

```csharp
public void SetTexture(Texture2D texture, int layer = 0)
```

### Parameters

**** (\[Texture2D]\(/engine/6000.7/script-reference/unityengine/texture2d)): The texture to assign.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Cannot be larger than [PlatformIcon.maxLayerCount](/engine/6000.7/script-reference/unityeditor/platformicon/maxlayercount.md).

### Remarks

Texture file must be stored in the project and instance obtained using [AssetDatabase.LoadAssetAtPath](/engine/6000.7/script-reference/unityeditor/assetdatabase/loadassetatpath.md).
