---
title: BindingSet
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/bindingset
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/bindingset.md
last_updated: 2026-11-30
generated_at: 2026-11-30T20:46:52.257Z
locale: en-us
---

# BindingSet

> Binding layout of a rig, used to find a binding by its identifier and to size the buffers of an animation stream.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Animations](/engine/7000.0/script-reference/unity/animations.md)
* **Assembly:** [UnityEngine.AnimationCoreModule](/engine/7000.0/script-reference/modules/unityengine-animationcoremodule.md)

```csharp
public struct BindingSet
```

## Remarks

A rig definition stores its binding set in [RigDefinition.Bindings](/engine/7000.0/script-reference/unity/animations/rigdefinition/bindings.md), and [RigBuilder](/engine/7000.0/script-reference/unity/animations/rigbuilder.md) fills it in when it creates the [RigDefinition](/engine/7000.0/script-reference/unity/animations/rigdefinition.md). Read a `BindingSet` to:

1. Find the index of a binding from its identifier. Pass an array of identifiers, such as [BindingSet.TranslationBindings](/engine/7000.0/script-reference/unity/animations/bindingset/translationbindings.md), to [BindingUtility.FindBindingIndex](/engine/7000.0/script-reference/unity/animations/bindingutility/findbindingindex.md).
2. Find the bit of a binding in the channel masks of an [AnimationStream](/engine/7000.0/script-reference/unity/animations/animationstream.md).
3. Find where the data of a binding is stored in the [AnimatedData](/engine/7000.0/script-reference/unity/animations/animateddata.md) buffer of an `AnimationStream`.
4. Allocate the buffer of an `AnimationStream` with [BindingSet.StreamSize](/engine/7000.0/script-reference/unity/animations/bindingset/streamsize.md) elements, or the buffer of an [AnimationStreamMask](/engine/7000.0/script-reference/unity/animations/animationstreammask.md) with [BindingSet.StreamMaskSize](/engine/7000.0/script-reference/unity/animations/bindingset/streammasksize.md) elements.

A binding connects one animated channel of the rig to a unique identifier. A rig has translation, rotation, scale, float, integer, and entity ID bindings.

The bindings of a rig are indexed in one sequence, in this order: translation, scale, float, integer, entity ID, and rotation. The first-binding index properties, such as [BindingSet.RotationBindingIndex](/engine/7000.0/script-reference/unity/animations/bindingset/rotationbindingindex.md) and [BindingSet.IntBindingIndex](/engine/7000.0/script-reference/unity/animations/bindingset/intbindingindex.md), give the index of the first binding of each kind. The channel masks of an `AnimationStream` use one bit for each binding, with this index.

A curve is one float value of a binding. A translation or scale binding has three curves, a rotation binding has four, and a float, integer, or entity ID binding has one. The curve count properties, such as [BindingSet.ScaleCurveCount](/engine/7000.0/script-reference/unity/animations/bindingset/scalecurvecount.md) and [BindingSet.FloatCurveCount](/engine/7000.0/script-reference/unity/animations/bindingset/floatcurvecount.md), give the number of curves of each kind.

The `AnimatedData` buffer of an `AnimationStream` has the following sections, in this order:

1. Translation values, stored as one `float3` for each translation binding, starting at [BindingSet.TranslationSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/translationsamplesoffset.md).
2. Scale values, stored as one `float3` for each scale binding, starting at [BindingSet.ScaleSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/scalesamplesoffset.md).
3. Float values, stored as one `float` for each float binding, starting at [BindingSet.FloatSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/floatsamplesoffset.md). The translation, scale, and float sections together fill [BindingSet.InterpolatedDataChunkCount](/engine/7000.0/script-reference/unity/animations/bindingset/interpolateddatachunkcount.md) `float4` chunks, so padding follows the float values.
4. Integer values, stored as one `int` for each integer binding, starting at [BindingSet.IntSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/intsamplesoffset.md).
5. Entity ID values, stored as one `EntityId` for each entity ID binding, starting at [BindingSet.EntityIdSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/entityidsamplesoffset.md). The integer and entity ID sections together fill [BindingSet.DiscreteDataChunkCount](/engine/7000.0/script-reference/unity/animations/bindingset/discretedatachunkcount.md) `int4` chunks, so padding follows the entity ID values.
6. Rotation values, stored in [quaternion4](/engine/7000.0/script-reference/unity/animations/quaternion4.md) chunks that each hold four rotations, starting at [BindingSet.RotationSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/rotationsamplesoffset.md). [BindingSet.RotationDataChunkCount](/engine/7000.0/script-reference/unity/animations/bindingset/rotationdatachunkcount.md) gives the number of chunks.
7. Channel masks, stored as two bit arrays with the pass mask first and the frame mask second, starting at [BindingSet.ChannelMaskOffset](/engine/7000.0/script-reference/unity/animations/bindingset/channelmaskoffset.md). Each mask has one bit for each binding, rounded up to a multiple of 64 bits.

Offsets and sizes count `AnimatedData` elements, which are 4 bytes each.

The following example uses the `Unity.Animations` and `Unity.Entities` namespaces. It finds a float channel by its identifier, then reads and writes its value in an animation stream.

Additional Resources: [BindingUtility](/engine/7000.0/script-reference/unity/animations/bindingutility.md), [RigDefinition](/engine/7000.0/script-reference/unity/animations/rigdefinition.md), [AnimationStream](/engine/7000.0/script-reference/unity/animations/animationstream.md)

## Examples

```csharp
// This example finds a float channel by its identifier, then increases its value in the animation stream.
// Returns false if the rig has no float channel with that identifier.
public static bool TryIncreaseFloatChannel(
    ref AnimationStream stream,
    StringHash channelId,
    float amount,
    out float newValue)
{
    // Search the float bindings of the rig of the stream. FindBindingIndex returns -1 when there is no match.
    ref BindingSet bindings = ref stream.RigDefinition.Bindings;
    int channelIndex = BindingUtility.FindBindingIndex(ref bindings.FloatBindings, channelId);
    if (channelIndex < 0)
    {
        newValue = 0f;
        return false;
    }

    // The binding index is also the index of the float in the stream.
    newValue = stream.GetFloat(channelIndex) + amount;
    stream.SetFloat(channelIndex, newValue);
    return true;
}
```

## Fields

| Value                                                                                                     | Description                                                                                                                                   |
| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| [EntityIdBindings](/engine/7000.0/script-reference/unity/animations/bindingset/entityidbindings.md)       | Identifiers of the entity ID bindings of the rig. The position of an identifier is the index of its binding among the entity ID bindings.     |
| [FloatBindings](/engine/7000.0/script-reference/unity/animations/bindingset/floatbindings.md)             | Identifiers of the float bindings of the rig. The position of an identifier is the index of its binding among the float bindings.             |
| [IntBindings](/engine/7000.0/script-reference/unity/animations/bindingset/intbindings.md)                 | Identifiers of the integer bindings of the rig. The position of an identifier is the index of its binding among the integer bindings.         |
| [RotationBindings](/engine/7000.0/script-reference/unity/animations/bindingset/rotationbindings.md)       | Identifiers of the rotation bindings of the rig. The position of an identifier is the index of its binding among the rotation bindings.       |
| [ScaleBindings](/engine/7000.0/script-reference/unity/animations/bindingset/scalebindings.md)             | Identifiers of the scale bindings of the rig. The position of an identifier is the index of its binding among the scale bindings.             |
| [TranslationBindings](/engine/7000.0/script-reference/unity/animations/bindingset/translationbindings.md) | Identifiers of the translation bindings of the rig. The position of an identifier is the index of its binding among the translation bindings. |

## Static Fields

| Value                                                                                                               | Description                                                                            |
| ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [EntityIdKeyFloatCount](/engine/7000.0/script-reference/unity/animations/bindingset/entityidkeyfloatcount.md)       | Number of curves of one entity ID binding. The curve of a clip stores an object index. |
| [FloatKeyFloatCount](/engine/7000.0/script-reference/unity/animations/bindingset/floatkeyfloatcount.md)             | Number of curves of one float binding.                                                 |
| [IntKeyFloatCount](/engine/7000.0/script-reference/unity/animations/bindingset/intkeyfloatcount.md)                 | Number of curves of one integer binding.                                               |
| [RotationKeyFloatCount](/engine/7000.0/script-reference/unity/animations/bindingset/rotationkeyfloatcount.md)       | Number of curves of one rotation binding: the quaternion x, y, z, and w.               |
| [ScaleKeyFloatCount](/engine/7000.0/script-reference/unity/animations/bindingset/scalekeyfloatcount.md)             | Number of curves of one scale binding: x, y, and z.                                    |
| [TranslationKeyFloatCount](/engine/7000.0/script-reference/unity/animations/bindingset/translationkeyfloatcount.md) | Number of curves of one translation binding: x, y, and z.                              |

## Properties

| Property                                                                                                                | Description                                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [BindingCount](/engine/7000.0/script-reference/unity/animations/bindingset/bindingcount.md)                             | Total number of bindings of the rig.                                                                                                                                         |
| [ChannelMaskOffset](/engine/7000.0/script-reference/unity/animations/bindingset/channelmaskoffset.md)                   | Offset of the channel masks in an animation stream buffer, in AnimatedData elements. The pass mask comes first, then the frame mask. Each mask has one bit for each binding. |
| [ChannelSize](/engine/7000.0/script-reference/unity/animations/bindingset/channelsize.md)                               | Size of the channel data of an animation stream, in AnimatedData elements. The size includes the padding that fills the chunks and excludes the channel masks.               |
| [CurveCount](/engine/7000.0/script-reference/unity/animations/bindingset/curvecount.md)                                 | Total number of curves of the rig.                                                                                                                                           |
| [DiscreteDataChunkCount](/engine/7000.0/script-reference/unity/animations/bindingset/discretedatachunkcount.md)         | Number of int4 chunks that hold the integer and entity ID data.                                                                                                              |
| [EntityIdBindingIndex](/engine/7000.0/script-reference/unity/animations/bindingset/entityidbindingindex.md)             | Index of the first entity ID binding among all the bindings of the rig.                                                                                                      |
| [EntityIdCurveCount](/engine/7000.0/script-reference/unity/animations/bindingset/entityidcurvecount.md)                 | Number of curves of all the entity ID bindings, one for each binding.                                                                                                        |
| [EntityIdSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/entityidsamplesoffset.md)           | Offset of the entity ID data in an animation stream buffer, in AnimatedData elements.                                                                                        |
| [FloatBindingIndex](/engine/7000.0/script-reference/unity/animations/bindingset/floatbindingindex.md)                   | Index of the first float binding among all the bindings of the rig.                                                                                                          |
| [FloatCurveCount](/engine/7000.0/script-reference/unity/animations/bindingset/floatcurvecount.md)                       | Number of curves of all the float bindings, one for each binding.                                                                                                            |
| [FloatSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/floatsamplesoffset.md)                 | Offset of the float data in an animation stream buffer, in AnimatedData elements.                                                                                            |
| [IntBindingIndex](/engine/7000.0/script-reference/unity/animations/bindingset/intbindingindex.md)                       | Index of the first integer binding among all the bindings of the rig.                                                                                                        |
| [IntCurveCount](/engine/7000.0/script-reference/unity/animations/bindingset/intcurvecount.md)                           | Number of curves of all the integer bindings, one for each binding.                                                                                                          |
| [InterpolatedDataChunkCount](/engine/7000.0/script-reference/unity/animations/bindingset/interpolateddatachunkcount.md) | Number of float4 chunks that hold the translation, scale and float data.                                                                                                     |
| [IntSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/intsamplesoffset.md)                     | Offset of the integer data in an animation stream buffer, in AnimatedData elements.                                                                                          |
| [RotationBindingIndex](/engine/7000.0/script-reference/unity/animations/bindingset/rotationbindingindex.md)             | Index of the first rotation binding among all the bindings of the rig.                                                                                                       |
| [RotationCurveCount](/engine/7000.0/script-reference/unity/animations/bindingset/rotationcurvecount.md)                 | Number of curves of all the rotation bindings, four for each binding.                                                                                                        |
| [RotationDataChunkCount](/engine/7000.0/script-reference/unity/animations/bindingset/rotationdatachunkcount.md)         | Number of chunks that hold the rotation data. Each chunk holds four rotations.                                                                                               |
| [RotationSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/rotationsamplesoffset.md)           | Offset of the rotation data in an animation stream buffer, in AnimatedData elements.                                                                                         |
| [ScaleBindingIndex](/engine/7000.0/script-reference/unity/animations/bindingset/scalebindingindex.md)                   | Index of the first scale binding among all the bindings of the rig.                                                                                                          |
| [ScaleCurveCount](/engine/7000.0/script-reference/unity/animations/bindingset/scalecurvecount.md)                       | Number of curves of all the scale bindings, three for each binding.                                                                                                          |
| [ScaleSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/scalesamplesoffset.md)                 | Offset of the scale data in an animation stream buffer, in AnimatedData elements.                                                                                            |
| [StreamMaskSize](/engine/7000.0/script-reference/unity/animations/bindingset/streammasksize.md)                         | Size of the buffer of an animation stream mask, in WeightData elements.                                                                                                      |
| [StreamSize](/engine/7000.0/script-reference/unity/animations/bindingset/streamsize.md)                                 | Size of the buffer of an animation stream, in AnimatedData elements. The buffer holds the channel data and the channel masks.                                                |
| [TranslationBindingIndex](/engine/7000.0/script-reference/unity/animations/bindingset/translationbindingindex.md)       | Index of the first translation binding among all the bindings of the rig. The value is always 0.                                                                             |
| [TranslationCurveCount](/engine/7000.0/script-reference/unity/animations/bindingset/translationcurvecount.md)           | Number of curves of all the translation bindings, three for each binding.                                                                                                    |
| [TranslationSamplesOffset](/engine/7000.0/script-reference/unity/animations/bindingset/translationsamplesoffset.md)     | Offset of the translation data in an animation stream buffer, in AnimatedData elements.                                                                                      |
