# SetIndexBufferParams(int, IndexFormat)

> Sets the index buffer size and format of the Mesh that Unity creates from the MeshData.

## Definition

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

```csharp
public void SetIndexBufferParams(int indexCount, IndexFormat format)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The size of the index buffer.**** (\[IndexFormat]\(/engine/6000.7/script-reference/unityengine/rendering/indexformat)): The format of the indices.

### Remarks

Use this method to set the index buffer size and format for the Mesh that Unity creates from the `MeshData` struct. For details, see [Mesh.SetIndexBufferParams](/engine/6000.7/script-reference/unityengine/mesh/setindexbufferparams.md).

After you have set the index buffer parameters, you can write the indices into the array returned by [Mesh.MeshData.GetIndexData](/engine/6000.7/script-reference/unityengine/mesh/meshdata/getindexdata.md). If you call this method on a read-only `MeshData`, Unity throws an exception.

Additional Resources: [Mesh.AllocateWritableMeshData](/engine/6000.7/script-reference/unityengine/mesh/allocatewritablemeshdata.md), [Mesh.AcquireReadOnlyMeshData](/engine/6000.7/script-reference/unityengine/mesh/acquirereadonlymeshdata.md).
