# GetColorArray

> Get a named color array.

## Definition

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

## GetColorArray(string)

Get a named color array.

```csharp
public Color[] GetColorArray(string name)
```

### Parameters

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

### Returns

| Type                                                              | Description |
| ----------------------------------------------------------------- | ----------- |
| [Color\[\]](/engine/6000.5/script-reference/unityengine/color.md) |             |

### Remarks

It is just an alias to [Material.GetVectorArray](/engine/6000.5/script-reference/unityengine/material/getvectorarray.md), only colors are cast to vectors. No sRGB-linear conversion is done during the function call.

Additional Resources: [Material.SetColorArray](/engine/6000.5/script-reference/unityengine/material/setcolorarray.md), [Material.GetVectorArray](/engine/6000.5/script-reference/unityengine/material/getvectorarray.md).

## GetColorArray(int)

Get a named color array.

```csharp
public Color[] GetColorArray(int nameID)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The name ID of the property retrieved by [Shader.PropertyToID](/engine/6000.5/script-reference/unityengine/shader/propertytoid.md).

### Returns

| Type                                                              | Description |
| ----------------------------------------------------------------- | ----------- |
| [Color\[\]](/engine/6000.5/script-reference/unityengine/color.md) |             |

### Remarks

It is just an alias to [Material.GetVectorArray](/engine/6000.5/script-reference/unityengine/material/getvectorarray.md), only colors are cast to vectors. No sRGB-linear conversion is done during the function call.

Additional Resources: [Material.SetColorArray](/engine/6000.5/script-reference/unityengine/material/setcolorarray.md), [Material.GetVectorArray](/engine/6000.5/script-reference/unityengine/material/getvectorarray.md).

## GetColorArray(string, List\<Color>)

Fetch a named color array into a list.

```csharp
public void GetColorArray(string name, List<Color> values)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.**** (\[List\<Color>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): The list to hold the returned array.

### Remarks

The list will be resized to the array size, or cleared if such property doesn't exist. Memory allocation is guaranteed not to happen during the function call.

## GetColorArray(int, List\<Color>)

Fetch a named color array into a list.

```csharp
public void GetColorArray(int nameID, List<Color> values)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The name ID of the property retrieved by [Shader.PropertyToID](/engine/6000.5/script-reference/unityengine/shader/propertytoid.md).**** (\[List\<Color>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): The list to hold the returned array.

### Remarks

The list will be resized to the array size, or cleared if such property doesn't exist. Memory allocation is guaranteed not to happen during the function call.
