Class TimelineAsset
A PlayableAsset that represents a timeline.
Inherited Members
Namespace: UnityEngine.Timeline
Assembly: Unity.Timeline.dll
Syntax
[ExcludeFromPreset]
[Serializable]
public class TimelineAsset : PlayableAsset, IPlayableAsset, ISerializationCallbackReceiver, ITimelineClipAsset, IPropertyPreview
Properties
clipCaps
The capabilities supported by all clips in the timeline.
Declaration
public ClipCaps clipCaps { get; }
Property Value
Type | Description |
---|---|
ClipCaps |
duration
The length, in seconds, of the timeline
Declaration
public override double duration { get; }
Property Value
Type | Description |
---|---|
double |
Overrides
durationMode
The mode used to determine the duration of the Timeline
Declaration
public TimelineAsset.DurationMode durationMode { get; set; }
Property Value
Type | Description |
---|---|
TimelineAsset.DurationMode |
editorSettings
Settings used by timeline for editing purposes
Declaration
public TimelineAsset.EditorSettings editorSettings { get; }
Property Value
Type | Description |
---|---|
TimelineAsset.EditorSettings |
fixedDuration
The length of the timeline when durationMode is set to fixed length.
Declaration
public double fixedDuration { get; set; }
Property Value
Type | Description |
---|---|
double |
markerTrack
Gets the marker track for this TimelineAsset.
Declaration
public MarkerTrack markerTrack { get; }
Property Value
Type | Description |
---|---|
MarkerTrack | Returns the marker track. |
Remarks
Use GetMarkers() to get a list of the markers on the returned track.
outputTrackCount
Returns the the number of output tracks in the Timeline.
Declaration
public int outputTrackCount { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
An output track is a track the generates a PlayableOutput. In general, an output track is any track that is not a GroupTrack, a subtrack, or override track.
outputs
A description of the PlayableOutputs that will be created by the timeline when instantiated.
Declaration
public override IEnumerable<PlayableBinding> outputs { get; }
Property Value
Type | Description |
---|---|
IEnumerable<PlayableBinding> |
Overrides
Remarks
Each track will create an PlayableOutput
rootTrackCount
Returns the number of tracks at the root level of the timeline.
Declaration
public int rootTrackCount { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
A root track refers to all tracks that occur at the root of the timeline. These are the outmost level GroupTracks, and output tracks that do not belong to any group
Methods
CreateMarkerTrack()
Creates a marker track for the TimelineAsset.
Declaration
public void CreateMarkerTrack()
Remarks
This track is always bound to the GameObject that contains the PlayableDirector component for the current timeline. The marker track is created the first time this method is called. If the marker track is already created, this method does nothing.
CreatePlayable(PlayableGraph, GameObject)
Creates an instance of the timeline
Declaration
public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
Parameters
Type | Name | Description |
---|---|---|
PlayableGraph | graph | PlayableGraph that will own the playable |
GameObject | go | The gameobject that triggered the graph build |
Returns
Type | Description |
---|---|
Playable | The Root Playable of the Timeline |
Overrides
CreateTrack(Type, TrackAsset, string)
Allows you to create a track and add it to the Timeline.
Declaration
public TrackAsset CreateTrack(Type type, TrackAsset parent, string name)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type of track to create. Must derive from TrackAsset. |
TrackAsset | parent | Track to parent to. This can be null. |
string | name | Name to give the track. |
Returns
Type | Description |
---|---|
TrackAsset | The created track. |
Remarks
This method will throw an InvalidOperationException if the parent is not valid. The parent can be any GroupTrack, or a supported parent type of track. For example, this can be used to create override tracks in AnimationTracks.
CreateTrack<T>()
Creates a track and adds it to the Timeline Asset.
Declaration
public T CreateTrack<T>() where T : TrackAsset, new()
Returns
Type | Description |
---|---|
T | Returns the created track. |
Type Parameters
Name | Description |
---|---|
T | The type of track being created. The track type must be derived from TrackAsset. |
CreateTrack<T>(string)
Creates a track and adds it to the Timeline Asset.
Declaration
public T CreateTrack<T>(string trackName) where T : TrackAsset, new()
Parameters
Type | Name | Description |
---|---|---|
string | trackName | The name of the track being created. |
Returns
Type | Description |
---|---|
T | Returns the created track. |
Type Parameters
Name | Description |
---|---|
T | The type of track being created. The track type must be derived from TrackAsset. |
CreateTrack<T>(TrackAsset, string)
Creates a track and adds it to the Timeline Asset.
Declaration
public T CreateTrack<T>(TrackAsset parent, string trackName) where T : TrackAsset, new()
Parameters
Type | Name | Description |
---|---|---|
TrackAsset | parent | Track to parent to. This can be null. |
string | trackName | The name of the track being created. |
Returns
Type | Description |
---|---|
T | Returns the created track. |
Type Parameters
Name | Description |
---|---|
T | The type of track being created. The track type must be derived from TrackAsset. |
Remarks
This method will throw an InvalidOperationException if the parent is not valid. The parent can be any GroupTrack, or a supported parent type of track. For example, this can be used to create override tracks in AnimationTracks.
DeleteClip(TimelineClip)
Delete a clip from this timeline.
Declaration
public bool DeleteClip(TimelineClip clip)
Parameters
Type | Name | Description |
---|---|---|
TimelineClip | clip | The clip to delete. |
Returns
Type | Description |
---|---|
bool | Returns true if the removal was successful |
Remarks
This method will delete a clip and any assets owned by the clip.
DeleteTrack(TrackAsset)
Deletes a track from a timeline, including all clips and subtracks.
Declaration
public bool DeleteTrack(TrackAsset track)
Parameters
Type | Name | Description |
---|---|---|
TrackAsset | track | The track to delete. It must be owned by this Timeline. |
Returns
Type | Description |
---|---|
bool | True if the track was deleted successfully. |
GatherProperties(PlayableDirector, IPropertyCollector)
Called by the Timeline Editor to gather properties requiring preview.
Declaration
public 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 |
GetOutputTrack(int)
Retrives the output track from the given index.
Declaration
public TrackAsset GetOutputTrack(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the output track to retrieve. Must be between 0 and outputTrackCount |
Returns
Type | Description |
---|---|
TrackAsset | The output track from the given index |
GetOutputTracks()
Gets a list of all output tracks in the Timeline.
Declaration
public IEnumerable<TrackAsset> GetOutputTracks()
Returns
Type | Description |
---|---|
IEnumerable<TrackAsset> | An IEnumerable of all output tracks |
Remarks
An output track is a track the generates a PlayableOutput. In general, an output track is any track that is not a GroupTrack or subtrack.
GetRootTrack(int)
Retrieves at root track at the specified index.
Declaration
public TrackAsset GetRootTrack(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the root track to get. Must be between 0 and rootTrackCount |
Returns
Type | Description |
---|---|
TrackAsset | Root track at the specified index. |
Remarks
A root track refers to all tracks that occur at the root of the timeline. These are the outmost level GroupTracks, and output tracks that do not belong to any group.
GetRootTracks()
Get an enumerable list of all root tracks.
Declaration
public IEnumerable<TrackAsset> GetRootTracks()
Returns
Type | Description |
---|---|
IEnumerable<TrackAsset> | An IEnumerable of all root tracks. |
Remarks
A root track refers to all tracks that occur at the root of the timeline. These are the outmost level GroupTracks, and output tracks that do not belong to any group.