# AllocateUIMesh(ExtraVertexChannels, int, int, out UIMesh)

> Allocates a fresh temporary UIMesh sized for vertexCount vertices and indexCount indices, with slices for the requested extras channels.

## Definition

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

## AllocateUIMesh(ExtraVertexChannels, int, int, UIMesh)

```csharp
public void AllocateUIMesh(ExtraVertexChannels channels, int vertexCount, int indexCount, out UIMesh mesh)
```

### Parameters

**** (\[ExtraVertexChannels]\(/engine/6000.6/script-reference/unityengine/uielements/extravertexchannels)): **** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): **** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): **** (\[UIMesh]\(/engine/6000.6/script-reference/unityengine/uielements/uimesh)):&#x20;

### Remarks

Channels not requested return as empty slices on the resulting [UIMesh](/engine/6000.6/script-reference/unityengine/uielements/uimesh.md). Use the result as input to [DrawData.SetMesh](/engine/6000.6/script-reference/unityengine/uielements/drawdata/setmesh.md) for tessellation refinement or wholesale geometry replacement. Memory is valid for the duration of this callback and any jobs added via [MeshModificationContext.AddMeshModificationJob](/engine/6000.6/script-reference/unityengine/uielements/meshmodificationcontext/addmeshmodificationjob.md).

Requested channels that are NOT enabled on the panel's [ExtraVertexChannels](/engine/6000.6/script-reference/unityengine/uielements/extravertexchannels.md) mask are dropped and the resulting `UIMesh` returns empty slices for those channels. Check slice lengths before filling.
