# SetData

> Set the buffer with values from an array.

## Definition

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

## SetData(Array)

Set the buffer with values from an array.

```csharp
public void SetData(Array data)
```

### Parameters

**** (\[Array]\(https\://learn.microsoft.com/dotnet/api/system.array)): Array of values to fill the buffer.

## SetData\<T>(List\<T>)

Set the buffer with values from an array.

```csharp
public void SetData<T>(List<T> data) where T : struct
```

### Parameters

**** (\[List\<T>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): Array of values to fill the buffer.

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

Set the buffer with values from an array.

```csharp
public void SetData<T>(NativeArray<T> data) where T : struct
```

### Parameters

**** (\[NativeArray\<T>]\(/engine/6000.5/script-reference/unity/collections/nativearray1)): Array of values to fill the buffer.

## SetData(Array, int, int, int)

Partial copy of data values from an array into the buffer.

```csharp
public void SetData(Array data, int managedBufferStartIndex, int graphicsBufferStartIndex, int count)
```

### Parameters

**** (\[Array]\(https\://learn.microsoft.com/dotnet/api/system.array)): Array of values to fill the buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The first element index in data to copy to the graphics buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The first element index in the graphics buffer to receive the data.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of elements to copy.

## SetData\<T>(List\<T>, int, int, int)

Partial copy of data values from an array into the buffer.

```csharp
public void SetData<T>(List<T> data, int managedBufferStartIndex, int graphicsBufferStartIndex, int count) where T : struct
```

### Parameters

**** (\[List\<T>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): Array of values to fill the buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The first element index in data to copy to the graphics buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The first element index in the graphics buffer to receive the data.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of elements to copy.

## SetData\<T>(NativeArray\<T>, int, int, int)

Partial copy of data values from an array into the buffer.

```csharp
public void SetData<T>(NativeArray<T> data, int nativeBufferStartIndex, int graphicsBufferStartIndex, int count) where T : struct
```

### Parameters

**** (\[NativeArray\<T>]\(/engine/6000.5/script-reference/unity/collections/nativearray1)): Array of values to fill the buffer.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): **** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The first element index in the graphics buffer to receive the data.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of elements to copy.
