# GetColors

> Populates an array with the vertex colors from the MeshData.

## Definition

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

## GetColors(NativeArray\<Color>)

Populates an array with the vertex colors from the `MeshData`.

```csharp
public void GetColors(NativeArray<Color> outColors)
```

### Parameters

**** (\[NativeArray\<Color>]\(/engine/6000.5/script-reference/unity/collections/nativearray1)): The destination vertex colors array.

### Remarks

The destination array must have at least [vertexCount](/engine/6000.5/script-reference/unityengine/mesh/meshdata/vertexcount.md) elements. The color at each index corresponds to the vertex with the same index. Vertex color data will be converted into [Color](/engine/6000.5/script-reference/unityengine/color.md) or [Color32](/engine/6000.5/script-reference/unityengine/color32.md) format if needed. Additional Resources: [Mesh.GetColors](/engine/6000.5/script-reference/unityengine/mesh/getcolors.md), [HasVertexAttribute](/engine/6000.5/script-reference/unityengine/mesh/meshdata/hasvertexattribute.md), [Mesh.AcquireReadOnlyMeshData](/engine/6000.5/script-reference/unityengine/mesh/acquirereadonlymeshdata.md).

## GetColors(NativeArray\<Color32>)

Populates an array with the vertex colors from the `MeshData`.

```csharp
public void GetColors(NativeArray<Color32> outColors)
```

### Parameters

**** (\[NativeArray\<Color32>]\(/engine/6000.5/script-reference/unity/collections/nativearray1)): The destination vertex colors array.

### Remarks

The destination array must have at least [vertexCount](/engine/6000.5/script-reference/unityengine/mesh/meshdata/vertexcount.md) elements. The color at each index corresponds to the vertex with the same index. Vertex color data will be converted into [Color](/engine/6000.5/script-reference/unityengine/color.md) or [Color32](/engine/6000.5/script-reference/unityengine/color32.md) format if needed. Additional Resources: [Mesh.GetColors](/engine/6000.5/script-reference/unityengine/mesh/getcolors.md), [HasVertexAttribute](/engine/6000.5/script-reference/unityengine/mesh/meshdata/hasvertexattribute.md), [Mesh.AcquireReadOnlyMeshData](/engine/6000.5/script-reference/unityengine/mesh/acquirereadonlymeshdata.md).
