# GetTexture

> Get a named texture.

## Definition

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

## GetTexture(string)

Get a named texture.

```csharp
public Texture GetTexture(string name)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.

### Returns

| Type                                                              | Description |
| ----------------------------------------------------------------- | ----------- |
| [Texture](/engine/6000.6/script-reference/unityengine/texture.md) |             |

### Remarks

Many shaders use more than one texture. Use GetTexture to get the `propertyName` texture.

If the texture is not found, the method writes an error message to the console and returns `null`.

Common texture names used by Unity's builtin shaders:

`"_MainTex"` is the main diffuse texture. This can also be accessed via [Material.mainTexture](/engine/6000.6/script-reference/unityengine/material/maintexture.md) property.

`"_BumpMap"` is the normal map.

`"_Cube"` is the reflection cubemap.

Additional Resources: [Material.mainTexture](/engine/6000.6/script-reference/unityengine/material/maintexture.md) property, [Material.SetTexture](/engine/6000.6/script-reference/unityengine/material/settexture.md),  [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md).

## GetTexture(int)

Get a named texture.

```csharp
public Texture GetTexture(int nameID)
```

### 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).

### Returns

| Type                                                              | Description |
| ----------------------------------------------------------------- | ----------- |
| [Texture](/engine/6000.6/script-reference/unityengine/texture.md) |             |

### Remarks

Many shaders use more than one texture. Use GetTexture to get the `propertyName` texture.

If the texture is not found, the method writes an error message to the console and returns `null`.

Common texture names used by Unity's builtin shaders:

`"_MainTex"` is the main diffuse texture. This can also be accessed via [Material.mainTexture](/engine/6000.6/script-reference/unityengine/material/maintexture.md) property.

`"_BumpMap"` is the normal map.

`"_Cube"` is the reflection cubemap.

Additional Resources: [Material.mainTexture](/engine/6000.6/script-reference/unityengine/material/maintexture.md) property, [Material.SetTexture](/engine/6000.6/script-reference/unityengine/material/settexture.md),  [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md).
