# MeshTopology

> Specifies how the indices in a mesh's index buffer are used to construct geometry.

## Definition

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

```csharp
public enum MeshTopology
```

## Remarks

Depending on the topology type, the combination of indices and vertices form shapes such as triangles, quads, lines, or points.

The most commonly used topology is [MeshTopology.Triangles](/engine/6000.7/script-reference/unityengine/meshtopology/triangles.md), as most hardware is optimized to render triangles efficiently. In meshes with multiple sub-meshes, the topology can be individually set for each sub-mesh.

This enum is commonly used in scripts to define geometry or create procedural meshes.

```csharp
// This example demonstrates how to create a mesh with two sub-meshes, each using a distinct topology.
Mesh mesh = new Mesh();
mesh.vertices = new Vector3[]
{
    new Vector3(0, 0, 0),
    new Vector3(1, 0, 0),
    new Vector3(0, 1, 0),
    new Vector3(1, 1, 0),
};
mesh.subMeshCount = 2;
mesh.SetIndices(new int[] { 0, 2, 1 }, MeshTopology.Triangles, 1);
mesh.SetIndices(new int[] { 0, 2, 3, 1, 0 }, MeshTopology.LineStrip, 0);
mesh.RecalculateNormals();
```

Additional Resources:  [Mesh](/engine/6000.7/script-reference/unityengine/mesh.md), [SubMeshDescriptor](/engine/6000.7/script-reference/unityengine/rendering/submeshdescriptor.md), [Mesh.SetIndices](/engine/6000.7/script-reference/unityengine/mesh/setindices.md).

## Fields

| Value                                                                              | Description                                                                 |
| ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [Lines](/engine/6000.7/script-reference/unityengine/meshtopology/lines.md)         | Connects pairs of indices to form individual line segments.                 |
| [LineStrip](/engine/6000.7/script-reference/unityengine/meshtopology/linestrip.md) | Connects indices consecutively to form a single continuous line.            |
| [Points](/engine/6000.7/script-reference/unityengine/meshtopology/points.md)       | Interprets indices as individual points without forming connected geometry. |
| [Quads](/engine/6000.7/script-reference/unityengine/meshtopology/quads.md)         | Connects indices in groups of four to form quadrilateral faces.             |
| [Triangles](/engine/6000.7/script-reference/unityengine/meshtopology/triangles.md) | Connects indices in groups of three to form triangular faces.               |
