# GetMaterial

> Gets the current Material assigned to the CanvasRenderer.

## Definition

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

## GetMaterial(int)

Gets the current [Material](/engine/6000.6/script-reference/unityengine/material.md) assigned to the CanvasRenderer.

```csharp
public Material GetMaterial(int index)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The material index to retrieve (0 if this parameter is omitted).

### Returns

| Type                                                                | Description |
| ------------------------------------------------------------------- | ----------- |
| [Material](/engine/6000.6/script-reference/unityengine/material.md) | Result.     |

## GetMaterial()

Gets the current [Material](/engine/6000.6/script-reference/unityengine/material.md) assigned to the CanvasRenderer.

```csharp
public Material GetMaterial()
```

### Returns

| Type                                                                | Description |
| ------------------------------------------------------------------- | ----------- |
| [Material](/engine/6000.6/script-reference/unityengine/material.md) | Result.     |
