Class AnimationTrack
A Timeline track used for playing back animations on an Animator.
Inherited Members
Namespace: UnityEngine.Timeline
Assembly: Unity.Timeline.dll
Syntax
[Serializable]
[TrackClipType(typeof(AnimationPlayableAsset), false)]
[TrackBindingType(typeof(Animator))]
[ExcludeFromPreset]
public class AnimationTrack : TrackAsset, IPlayableAsset, ISerializationCallbackReceiver, IPropertyPreview, ILayerable
Properties
applyAvatarMask
Specifies whether to apply the AvatarMask to the track.
Declaration
public bool applyAvatarMask { get; set; }
Property Value
Type | Description |
---|---|
bool |
applyOffsets
Specifies whether to apply track offsets to all clips on the track.
Declaration
[Obsolete("applyOffset is deprecated. Use trackOffset instead", true)]
public bool applyOffsets { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This can be used to offset all clips on a track, in addition to the clips individual offsets.
avatarMask
Specifies the AvatarMask to be applied to all clips on the track.
Declaration
public AvatarMask avatarMask { get; set; }
Property Value
Type | Description |
---|---|
AvatarMask |
Remarks
Applying an AvatarMask to an animation track will allow discarding portions of the animation being applied on the track.
eulerAngles
The euler angle representation of the rotation offset of the entire track.
Declaration
public Vector3 eulerAngles { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
inClipMode
Specifies whether the Animation Track has clips, or is in infinite mode.
Declaration
public bool inClipMode { get; }
Property Value
Type | Description |
---|---|
bool |
infiniteClip
An AnimationClip storing the data for an infinite track.
Declaration
public AnimationClip infiniteClip { get; }
Property Value
Type | Description |
---|---|
AnimationClip |
Remarks
The value of this property is null when the AnimationTrack is in Clip Mode.
infiniteClipOffsetEulerAngles
The euler angle representation of the rotation offset of the track when in infinite mode.
Declaration
public Vector3 infiniteClipOffsetEulerAngles { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
infiniteClipOffsetPosition
The translation offset of a track in infinite mode.
Declaration
public Vector3 infiniteClipOffsetPosition { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
infiniteClipOffsetRotation
The rotation offset of a track in infinite mode.
Declaration
public Quaternion infiniteClipOffsetRotation { get; set; }
Property Value
Type | Description |
---|---|
Quaternion |
infiniteClipPostExtrapolation
The saved state of post-extrapolation for clips when converted to infinite mode.
Declaration
public TimelineClip.ClipExtrapolation infiniteClipPostExtrapolation { get; set; }
Property Value
Type | Description |
---|---|
TimelineClip.ClipExtrapolation |
infiniteClipPreExtrapolation
The saved state of pre-extrapolation for clips converted to infinite mode.
Declaration
public TimelineClip.ClipExtrapolation infiniteClipPreExtrapolation { get; set; }
Property Value
Type | Description |
---|---|
TimelineClip.ClipExtrapolation |
matchTargetFields
Specifies which fields to match when aligning offsets of clips.
Declaration
public MatchTargetFields matchTargetFields { get; set; }
Property Value
Type | Description |
---|---|
MatchTargetFields |
outputs
Returns a description of the PlayableOutputs that will be created by this track.
Declaration
public override IEnumerable<PlayableBinding> outputs { get; }
Property Value
Type | Description |
---|---|
IEnumerable<PlayableBinding> |
Overrides
position
The translation offset of the entire track.
Declaration
public Vector3 position { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
rotation
The rotation offset of the entire track, expressed as a quaternion.
Declaration
public Quaternion rotation { get; set; }
Property Value
Type | Description |
---|---|
Quaternion |
trackOffset
Specifies what is used to set the starting position and orientation of an Animation Track.
Declaration
public TrackOffset trackOffset { get; set; }
Property Value
Type | Description |
---|---|
TrackOffset |
Remarks
Track Offset is only applied when the Animation Track contains animation that modifies the root Transform.
Methods
CalculateItemsHash()
Declaration
protected override int CalculateItemsHash()
Returns
Type | Description |
---|---|
int |
Overrides
CreateClip(AnimationClip)
Creates a TimelineClip on this track that uses an AnimationClip.
Declaration
public TimelineClip CreateClip(AnimationClip clip)
Parameters
Type | Name | Description |
---|---|---|
AnimationClip | clip | Source animation clip of the resulting TimelineClip. |
Returns
Type | Description |
---|---|
TimelineClip | A new TimelineClip which has an AnimationPlayableAsset asset attached. |
CreateInfiniteClip(string)
Creates an AnimationClip that stores the data for an infinite track.
Declaration
public void CreateInfiniteClip(string infiniteClipName)
Parameters
Type | Name | Description |
---|---|---|
string | infiniteClipName | The name of the AnimationClip to create. This method does not ensure unique names. If you want a unique clip name, you must provide one. See ObjectNames.GetUniqueName for information on a method that creates unique names. |
Remarks
If an infiniteClip already exists, this method produces no result, even if you provide a different value for infiniteClipName.
CreateRecordableClip(string)
Creates a TimelineClip, AnimationPlayableAsset and an AnimationClip. Use this clip to record in a timeline.
Declaration
public TimelineClip CreateRecordableClip(string animClipName)
Parameters
Type | Name | Description |
---|---|---|
string | animClipName | The name of the AnimationClip to create. This method does not ensure unique names. If you want a unique clip name, you must provide one. See ObjectNames.GetUniqueName for information on a method that creates unique names. |
Returns
Type | Description |
---|---|
TimelineClip | Returns a new TimelineClip with an AnimationPlayableAsset asset attached. |
Remarks
When used from the editor, this method attempts to save the created recordable clip to the TimelineAsset. The TimelineAsset must already exist in the AssetDatabase to save the recordable clip. If the TimelineAsset does not exist, the recordable clip is still created but it is not saved.
GatherProperties(PlayableDirector, IPropertyCollector)
Called by the Timeline Editor to gather properties requiring preview.
Declaration
public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
Parameters
Type | Name | Description |
---|---|---|
PlayableDirector | director | The PlayableDirector invoking the preview |
IPropertyCollector | driver | PropertyCollector used to gather previewable properties |
Overrides
OnCreateClip(TimelineClip)
Used to initialize default values on a newly created clip
Declaration
protected override void OnCreateClip(TimelineClip clip)
Parameters
Type | Name | Description |
---|---|---|
TimelineClip | clip | The clip added to the track |