# MeshWriteData

> Represents the vertex and index data allocated for drawing the content of a VisualElement.

## Definition

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

```csharp
public class MeshWriteData
```

## Remarks

You can use this object to fill the values for the vertices and indices only during a callback to the [\_generateVisualContent](/engine/6000.5/script-reference/unityengine/uielements/visualelement/generatevisualcontent.md) delegate. Do not store the passed [MeshWriteData](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata.md) outside the scope of [\_generateVisualContent](/engine/6000.5/script-reference/unityengine/uielements/visualelement/generatevisualcontent.md) as Unity could recycle it for other callbacks.

## Properties

| Property                                                                                           | Description                                                                                                                                                 |
| -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [indexCount](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata/indexcount.md)   | The number of indices successfully allocated for [VisualElement](/engine/6000.5/script-reference/unityengine/uielements/visualelement.md) content drawing.  |
| [vertexCount](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata/vertexcount.md) | The number of vertices successfully allocated for [VisualElement](/engine/6000.5/script-reference/unityengine/uielements/visualelement.md) content drawing. |

## Methods

| Method                                                                                                   | Description                                                                                                                                                                                                                                                                                            |
| -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [SetAllIndices](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata/setallindices.md)   | Fills the values of the allocated indices with values copied directly from an array. Each 3 consecutive indices form a single triangle.                                                                                                                                                                |
| [SetAllVertices](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata/setallvertices.md) | Fills the values of the allocated vertices with values copied directly from an array. When this method is called, it is not possible to use [MeshWriteData.SetNextVertex](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata/setnextvertex.md) to fill the allocated vertices array. |
| [SetNextIndex](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata/setnextindex.md)     | Assigns the value of the next index of the allocated indices list.                                                                                                                                                                                                                                     |
| [SetNextVertex](/engine/6000.5/script-reference/unityengine/uielements/meshwritedata/setnextvertex.md)   | Assigns the value of the next vertex of the allocated vertices list.                                                                                                                                                                                                                                   |
