# SetNextIndex(ushort)

> Assigns the value of the next index of the allocated indices list.

## Definition

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

```csharp
public void SetNextIndex(ushort index)
```

### Parameters

**** (\[ushort]\(https\://learn.microsoft.com/dotnet/api/system.uint16)): The value of the next index.

### Remarks

Used to iteratively fill the values of the allocated indices via repeated calls to this function until all values have been provided. This way of filling index data is mutually exclusive with the use of [MeshWriteData.SetAllIndices](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata/setallindices.md). After each invocation to this function, the internal counter for the next index is automatically incremented. When this method is called, it is not possible to use [MeshWriteData.SetAllIndices](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata/setallindices.md) to fill the indices. The index values provided refer directly to the vertices allocated in the same [MeshWriteData](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata.md) object. Thus, an index of 0 means the first vertex and index 1 means the second vertex and so on.

Note that calling [MeshWriteData.SetNextIndex](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata/setnextindex.md) fewer times than the allocated number of indices will leave the remaining indices with random values as [MeshGenerationContext.Allocate](/engine/6000.5/script-reference/unityengine/uielements/meshgenerationcontext/allocate.md) does not initialize the returned data to 0 to avoid redundant work.
