AnimatableIntChannels
A set of named integer channels that a script component exposes to the animation system.
Read time 1 minuteLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
- Implements: IEnumerable<KeyValuePair<string, int>>, IEnumerable
public sealed class AnimatableIntChannels : IEnumerable<KeyValuePair<string, int>>, IEnumerable
Remarks
Each channel holds an integer value. Animate the channels with discrete curves, which change the value in steps instead of blending between keys. Declare, name, and bind the channels in the same way as for AnimatableFloatChannels.
The following example exposes a channel that selects a frame, and logs the frame when an animation changes it.
using UnityEngine;public class FrameSelector : MonoBehaviour{ // Animate this channel as "frames.Mouth". public AnimatableIntChannels frames = new AnimatableIntChannels(); // Reset runs when you add the component in the Editor. The channel names are saved with the component. void Reset() { frames.SetChannels("Mouth"); } void OnDidApplyAnimationProperties() { Debug.Log("Mouth frame: " + frames[0]); }}
Constructors
Constructor | Description |
|---|---|
| AnimatableIntChannels() | Creates an empty channel set. |
Properties
Property | Description |
|---|---|
| channelCount | The number of channels in the set. |
| this[] | The value of the channel at a position in the set. |
Methods
Method | Description |
|---|---|
| GetChannelName | Gets the name of the channel at a position in the set. |
| GetEnumerator | Gets an enumerator that iterates over the name and value of each channel, in the order of the set. |
| IndexOf | Finds the position of a channel in the set by name. |
| SetChannels | Replaces the channel set with channels that have the given names. |
Structs
Struct | Description |
|---|---|
| AnimatableIntChannels.Enumerator | Enumerates the name and value of each channel in an AnimatableIntChannels set. |