# AnimatableObjectChannels

> A set of named object reference channels that a script component exposes to the animation system.

## Definition

* **Type:** Class
* **Namespace:** [UnityEngine](/engine/7000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule
* **Implements:** [IEnumerable\<KeyValuePair\<string, Object>>](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1), [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.ienumerable)

```csharp
public sealed class AnimatableObjectChannels : IEnumerable<KeyValuePair<string, Object>>, IEnumerable
```

## Remarks

Each channel holds a reference to a Unity object, such as a sprite. Animate the channels with object reference curves, in the same way as you animate the sprite of a [SpriteRenderer](/engine/7000.0/script-reference/unityengine/spriterenderer.md). Declare, name, and bind the channels in the same way as for [AnimatableFloatChannels](/engine/7000.0/script-reference/unityengine/animatablefloatchannels.md).

The following example exposes two channels and logs the objects they reference when an animation changes them.

```csharp
using UnityEngine;

public class PartSprites : MonoBehaviour
{
    // Animate these channels as "parts.Head" and "parts.Body".
    public AnimatableObjectChannels parts = new AnimatableObjectChannels();

    // Reset runs when you add the component in the Editor. The channel names are saved with the component.
    void Reset()
    {
        parts.SetChannels("Head", "Body");
    }

    void OnDidApplyAnimationProperties()
    {
        foreach (var part in parts)
            Debug.Log(part.Key + " uses " + (part.Value != null ? part.Value.name : "nothing"));
    }
}
```

Additional Resources: [AnimatableFloatChannels](/engine/7000.0/script-reference/unityengine/animatablefloatchannels.md), [AnimatableIntChannels](/engine/7000.0/script-reference/unityengine/animatableintchannels.md), [Animator.Rebind](/engine/7000.0/script-reference/unityengine/animator/rebind.md)

## Constructors

| Constructor                                                                                                | Description                   |
| ---------------------------------------------------------------------------------------------------------- | ----------------------------- |
| [AnimatableObjectChannels()](/engine/7000.0/script-reference/unityengine/animatableobjectchannels/ctor.md) | Creates an empty channel set. |

## Properties

| Property                                                                                             | Description                                                      |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| [channelCount](/engine/7000.0/script-reference/unityengine/animatableobjectchannels/channelcount.md) | The number of channels in the set.                               |
| [this\[\]](/engine/7000.0/script-reference/unityengine/animatableobjectchannels/item.md)             | The object that the channel at a position in the set references. |

## Methods

| Method                                                                                                   | Description                                                                                        |
| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| [GetChannelName](/engine/7000.0/script-reference/unityengine/animatableobjectchannels/getchannelname.md) | Gets the name of the channel at a position in the set.                                             |
| [GetEnumerator](/engine/7000.0/script-reference/unityengine/animatableobjectchannels/getenumerator.md)   | Gets an enumerator that iterates over the name and value of each channel, in the order of the set. |
| [IndexOf](/engine/7000.0/script-reference/unityengine/animatableobjectchannels/indexof.md)               | Finds the position of a channel in the set by name.                                                |
| [SetChannels](/engine/7000.0/script-reference/unityengine/animatableobjectchannels/setchannels.md)       | Replaces the channel set with channels that have the given names.                                  |

## Structs

| Struct                                                                                                                    | Description                                                                                                                                                  |
| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [AnimatableObjectChannels.Enumerator](/engine/7000.0/script-reference/unityengine/animatableobjectchannels/enumerator.md) | Enumerates the name and value of each channel in an [AnimatableObjectChannels](/engine/7000.0/script-reference/unityengine/animatableobjectchannels.md) set. |
