# BlendShapeBufferRange

> Describes the location of blend shape vertex data in a GraphicsBuffer.

## Definition

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

```csharp
public struct BlendShapeBufferRange
```

## Remarks

When you call [Mesh.GetBlendShapeBuffer](/engine/6000.6/script-reference/unityengine/mesh/getblendshapebuffer.md) with [BlendShapeBufferLayout.PerShape](/engine/6000.6/script-reference/unityengine/rendering/blendshapebufferlayout/pershape.md), Unity returns a [GraphicsBuffer](/engine/6000.6/script-reference/unityengine/graphicsbuffer.md) that contains blend shape vertex data, ordered by blend shape.

When you call [Mesh.GetBlendShapeBufferRange](/engine/6000.6/script-reference/unityengine/mesh/getblendshapebufferrange.md) for a given blend shape, Unity returns this struct. Use this struct to locate the data for that blend shape in the `GraphicsBuffer`.

```csharp
using UnityEngine;
using UnityEngine.Rendering;

public class Example : MonoBehaviour
{
    public Mesh mesh;
    public ComputeShader computeShader;

    void Start()
    {
        // Fetch GraphicsBuffer with Blend Shape data, ordered per shape, from the mesh
        var perShapeBuffer = mesh.GetBlendShapeBuffer(BlendShapeBufferLayout.PerShape);

        // Iterate over all Blend Shapes in a mesh
        for (int blendShapeIndex = 0; blendShapeIndex  < mesh.blendShapeCount; ++blendShapeIndex)
        {
            // Fetch which indices in the buffer that is part of this Blend Shape
            var blendShapeRange = mesh.GetBlendShapeBufferRange(blendShapeIndex);

            // Set the start and end indices of the Blend Shape in the compute shader
            computeShader.SetInt("_StartIndex", (int)blendShapeRange.startIndex);
            computeShader.SetInt("_EndIndex", (int)blendShapeRange.endIndex);

            // Dispatch compute shader and access data between start and end index for this Blend Shape
            computeShader.Dispatch(0, 64, 1, 1);
        }

        // Dispose of GraphicsBuffer to avoid leak memory
        perShapeBuffer.Dispose();
    }
}
```

Additional Resources: [Mesh.GetBlendShapeBuffer](/engine/6000.6/script-reference/unityengine/mesh/getblendshapebuffer.md), [Mesh.GetBlendShapeBufferRange](/engine/6000.6/script-reference/unityengine/mesh/getblendshapebufferrange.md), [BlendShapeBufferLayout.PerShape](/engine/6000.6/script-reference/unityengine/rendering/blendshapebufferlayout/pershape.md).

## Properties

| Property                                                                                      | Description                                                              |
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| [endIndex](/engine/6000.6/script-reference/unityengine/blendshapebufferrange/endindex.md)     | The index of the last blend shape vertex for the requested blend shape.  |
| [startIndex](/engine/6000.6/script-reference/unityengine/blendshapebufferrange/startindex.md) | The index of the first blend shape vertex for the requested blend shape. |
