# SetColors

> Set the per-vertex colors of the Mesh.

## Definition

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

## SetColors(List\<Color>)

Set the per-vertex colors of the Mesh.

```csharp
public void SetColors(List<Color> inColors)
```

### Parameters

**** (\[List\<Color>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): Per-vertex colors.

### Remarks

Unity internally stores Mesh data in the format matching the data you supply. For example, if you pass a [Color32](/engine/6000.0/script-reference/unityengine/color32.md) array Unity will store each color in 4 bytes (low precision, 0..1 range); whereas if you pass a [Color](/engine/6000.0/script-reference/unityengine/color.md) array, Unity stores each color in 16 bytes (full 32 bit float per color channel).

If you use a `List`, Unity copies the values. If you change the `List`, the Mesh colors won't change unless you call `Mesh.SetColors` again.

Additional Resources: [Mesh.colors](/engine/6000.0/script-reference/unityengine/mesh/colors.md), [Mesh.colors32](/engine/6000.0/script-reference/unityengine/mesh/colors32.md) properties.

## SetColors(List\<Color>, int, int, MeshUpdateFlags)

Sets the per-vertex colors of the Mesh, using a part of the input array.

```csharp
public void SetColors(List<Color> inColors, int start, int length, MeshUpdateFlags flags)
```

### Parameters

**** (\[List\<Color>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): Per-vertex colors.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the first element to take from the input array.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of elements to take from the input array.**** (\[MeshUpdateFlags]\(/engine/6000.0/script-reference/unityengine/rendering/meshupdateflags)): Flags controlling the function behavior, see [MeshUpdateFlags](/engine/6000.0/script-reference/unityengine/rendering/meshupdateflags.md).

### Remarks

This method behaves as if you called SetColors with an array that is a slice of the whole array, starting at start index and being of a given length. The resulting Mesh has length amount of vertices.

## SetColors(Color\[])

Set the per-vertex colors of the Mesh.

```csharp
public void SetColors(Color[] inColors)
```

### Parameters

**** (\[Color\[]]\(/engine/6000.0/script-reference/unityengine/color)): Per-vertex colors.

### Remarks

Unity internally stores Mesh data in the format matching the data you supply. For example, if you pass a [Color32](/engine/6000.0/script-reference/unityengine/color32.md) array Unity will store each color in 4 bytes (low precision, 0..1 range); whereas if you pass a [Color](/engine/6000.0/script-reference/unityengine/color.md) array, Unity stores each color in 16 bytes (full 32 bit float per color channel).

If you use a `List`, Unity copies the values. If you change the `List`, the Mesh colors won't change unless you call `Mesh.SetColors` again.

Additional Resources: [Mesh.colors](/engine/6000.0/script-reference/unityengine/mesh/colors.md), [Mesh.colors32](/engine/6000.0/script-reference/unityengine/mesh/colors32.md) properties.

## SetColors(Color\[], int, int, MeshUpdateFlags)

Sets the per-vertex colors of the Mesh, using a part of the input array.

```csharp
public void SetColors(Color[] inColors, int start, int length, MeshUpdateFlags flags)
```

### Parameters

**** (\[Color\[]]\(/engine/6000.0/script-reference/unityengine/color)): Per-vertex colors.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the first element to take from the input array.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of elements to take from the input array.**** (\[MeshUpdateFlags]\(/engine/6000.0/script-reference/unityengine/rendering/meshupdateflags)): Flags controlling the function behavior, see [MeshUpdateFlags](/engine/6000.0/script-reference/unityengine/rendering/meshupdateflags.md).

### Remarks

This method behaves as if you called SetColors with an array that is a slice of the whole array, starting at start index and being of a given length. The resulting Mesh has length amount of vertices.

## SetColors(List\<Color32>)

Set the per-vertex colors of the Mesh.

```csharp
public void SetColors(List<Color32> inColors)
```

### Parameters

**** (\[List\<Color32>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): Per-vertex colors.

### Remarks

Unity internally stores Mesh data in the format matching the data you supply. For example, if you pass a [Color32](/engine/6000.0/script-reference/unityengine/color32.md) array Unity will store each color in 4 bytes (low precision, 0..1 range); whereas if you pass a [Color](/engine/6000.0/script-reference/unityengine/color.md) array, Unity stores each color in 16 bytes (full 32 bit float per color channel).

If you use a `List`, Unity copies the values. If you change the `List`, the Mesh colors won't change unless you call `Mesh.SetColors` again.

Additional Resources: [Mesh.colors](/engine/6000.0/script-reference/unityengine/mesh/colors.md), [Mesh.colors32](/engine/6000.0/script-reference/unityengine/mesh/colors32.md) properties.

## SetColors(List\<Color32>, int, int, MeshUpdateFlags)

Sets the per-vertex colors of the Mesh, using a part of the input array.

```csharp
public void SetColors(List<Color32> inColors, int start, int length, MeshUpdateFlags flags)
```

### Parameters

**** (\[List\<Color32>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): Per-vertex colors.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the first element to take from the input array.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of elements to take from the input array.**** (\[MeshUpdateFlags]\(/engine/6000.0/script-reference/unityengine/rendering/meshupdateflags)): Flags controlling the function behavior, see [MeshUpdateFlags](/engine/6000.0/script-reference/unityengine/rendering/meshupdateflags.md).

### Remarks

This method behaves as if you called SetColors with an array that is a slice of the whole array, starting at start index and being of a given length. The resulting Mesh has length amount of vertices.

## SetColors(Color32\[])

Set the per-vertex colors of the Mesh.

```csharp
public void SetColors(Color32[] inColors)
```

### Parameters

**** (\[Color32\[]]\(/engine/6000.0/script-reference/unityengine/color32)): Per-vertex colors.

### Remarks

Unity internally stores Mesh data in the format matching the data you supply. For example, if you pass a [Color32](/engine/6000.0/script-reference/unityengine/color32.md) array Unity will store each color in 4 bytes (low precision, 0..1 range); whereas if you pass a [Color](/engine/6000.0/script-reference/unityengine/color.md) array, Unity stores each color in 16 bytes (full 32 bit float per color channel).

If you use a `List`, Unity copies the values. If you change the `List`, the Mesh colors won't change unless you call `Mesh.SetColors` again.

Additional Resources: [Mesh.colors](/engine/6000.0/script-reference/unityengine/mesh/colors.md), [Mesh.colors32](/engine/6000.0/script-reference/unityengine/mesh/colors32.md) properties.

## SetColors(Color32\[], int, int, MeshUpdateFlags)

Sets the per-vertex colors of the Mesh, using a part of the input array.

```csharp
public void SetColors(Color32[] inColors, int start, int length, MeshUpdateFlags flags)
```

### Parameters

**** (\[Color32\[]]\(/engine/6000.0/script-reference/unityengine/color32)): Per-vertex colors.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the first element to take from the input array.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of elements to take from the input array.**** (\[MeshUpdateFlags]\(/engine/6000.0/script-reference/unityengine/rendering/meshupdateflags)): Flags controlling the function behavior, see [MeshUpdateFlags](/engine/6000.0/script-reference/unityengine/rendering/meshupdateflags.md).

### Remarks

This method behaves as if you called SetColors with an array that is a slice of the whole array, starting at start index and being of a given length. The resulting Mesh has length amount of vertices.

## SetColors\<T>(NativeArray\<T>)

Set the per-vertex colors of the Mesh.

```csharp
public void SetColors<T>(NativeArray<T> inColors) where T : struct
```

### Parameters

**** (\[NativeArray\<T>]\(/engine/6000.0/script-reference/unity/collections/nativearray1)): Per-vertex colors.

### Remarks

Unity internally stores Mesh data in the format matching the data you supply. For example, if you pass a [Color32](/engine/6000.0/script-reference/unityengine/color32.md) array Unity will store each color in 4 bytes (low precision, 0..1 range); whereas if you pass a [Color](/engine/6000.0/script-reference/unityengine/color.md) array, Unity stores each color in 16 bytes (full 32 bit float per color channel).

If you use a `List`, Unity copies the values. If you change the `List`, the Mesh colors won't change unless you call `Mesh.SetColors` again.

Additional Resources: [Mesh.colors](/engine/6000.0/script-reference/unityengine/mesh/colors.md), [Mesh.colors32](/engine/6000.0/script-reference/unityengine/mesh/colors32.md) properties.

## SetColors\<T>(NativeArray\<T>, int, int, MeshUpdateFlags)

Sets the per-vertex colors of the Mesh, using a part of the input array.

```csharp
public void SetColors<T>(NativeArray<T> inColors, int start, int length, MeshUpdateFlags flags) where T : struct
```

### Parameters

**** (\[NativeArray\<T>]\(/engine/6000.0/script-reference/unity/collections/nativearray1)): Per-vertex colors.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the first element to take from the input array.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of elements to take from the input array.**** (\[MeshUpdateFlags]\(/engine/6000.0/script-reference/unityengine/rendering/meshupdateflags)): Flags controlling the function behavior, see [MeshUpdateFlags](/engine/6000.0/script-reference/unityengine/rendering/meshupdateflags.md).

### Remarks

This method behaves as if you called SetColors with an array that is a slice of the whole array, starting at start index and being of a given length. The resulting Mesh has length amount of vertices.
