# RenderSpriteToTexture2D(Sprite, int, int, Material, int, bool)

> Renders a vector sprite to Texture2D.

## Definition

* **Type:** Method
* **Namespace:** [Unity.VectorGraphics](/engine/6000.7/script-reference/unity/vectorgraphics.md)
* **Assembly:** UnityEngine.VectorGraphicsModule

```csharp
public static Texture2D RenderSpriteToTexture2D(Sprite sprite, int width, int height, Material mat, int antiAliasing = 1, bool expandEdges = false)
```

### Parameters

**** (\[Sprite]\(/engine/6000.7/script-reference/unityengine/sprite)): The sprite to render**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The desired width of the resulting texture**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The desired height of the resulting texture**** (\[Material]\(/engine/6000.7/script-reference/unityengine/material)): The material used to render the sprite**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of samples per pixel for anti-aliasing**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): When true, expand the edges to avoid a dark banding effect caused by filtering. This is slower to render and uses more graphics memory.

### Returns

| Type                                                                  | Description                                              |
| --------------------------------------------------------------------- | -------------------------------------------------------- |
| [Texture2D](/engine/6000.7/script-reference/unityengine/texture2d.md) | A Texture2D object containing the rendered vector sprite |
