# GetSprites

> Clone all the Sprite in this atlas and fill them into the supplied array.

## Definition

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

## GetSprites(Sprite\[])

Clone all the [Sprite](/engine/6000.5/script-reference/unityengine/sprite.md) in this atlas and fill them into the supplied array.

```csharp
public int GetSprites(Sprite[] sprites)
```

### Parameters

**** (\[Sprite\[]]\(/engine/6000.5/script-reference/unityengine/sprite)): Array of [Sprite](/engine/6000.5/script-reference/unityengine/sprite.md) that will be filled.

### Returns

| Type                                                       | Description                     |
| ---------------------------------------------------------- | ------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The size of the returned array. |

### Remarks

The array will not be resized if it doesn't contain enough elements to be filled. Please use [SpriteAtlas.spriteCount](/engine/6000.5/script-reference/unityengine/u2d/spriteatlas/spritecount.md) to determine the size for the array.

Due to the nature of the packing algorithm, Sprites in this list are sorted by their area size, in descending order.

## GetSprites(Sprite\[], string)

Clone all the [Sprite](/engine/6000.5/script-reference/unityengine/sprite.md) matching the name in this atlas and fill them into the supplied array.

```csharp
public int GetSprites(Sprite[] sprites, string name)
```

### Parameters

**** (\[Sprite\[]]\(/engine/6000.5/script-reference/unityengine/sprite)): Array of [Sprite](/engine/6000.5/script-reference/unityengine/sprite.md) that will be filled.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the [Sprite](/engine/6000.5/script-reference/unityengine/sprite.md).

### Returns

| Type                                                       | Description |
| ---------------------------------------------------------- | ----------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) |             |
