Class TimelineAssetExtensions
A collection of helpers to manipulate TimelineAsset instances.
Inherited Members
Namespace: UnityEngine.Sequences.Timeline
Assembly: Unity.Sequences.dll
Syntax
public static class TimelineAssetExtensions
Methods
FindDirector(TimelineAsset)
Finds a PlayableDirector in loaded scenes that references the given TimelineAsset.
Declaration
public static PlayableDirector FindDirector(this TimelineAsset timeline)
Parameters
| Type | Name | Description |
|---|---|---|
| TimelineAsset | timeline | The instance of TimelineAsset to look for. |
Returns
| Type | Description |
|---|---|
| PlayableDirector | Null when no matching PlayableDirector is found. |
GetOrCreateTrack<T>(TimelineAsset, string)
Gets a track of type T with the specified name.
Creates a new track with the specified name if none is found.
Declaration
public static T GetOrCreateTrack<T>(this TimelineAsset asset, string name) where T : TrackAsset, new()
Parameters
| Type | Name | Description |
|---|---|---|
| TimelineAsset | asset | The instance of TimelineAsset to look into. |
| string | name | The name the TrackAsset has in Timeline. |
Returns
| Type | Description |
|---|---|
| T | A valid instance of a TrackAsset of type T. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the track to look for. |
GetScenes(TimelineAsset)
Gets a collection of scene paths found in the given timeline.
Declaration
public static IReadOnlyCollection<string> GetScenes(this TimelineAsset timeline)
Parameters
| Type | Name | Description |
|---|---|---|
| TimelineAsset | timeline | The instance of TimelineAsset this method applies to. |
Returns
| Type | Description |
|---|---|
| IReadOnlyCollection<string> | A read only collection of paths, relative to the project folder. |
GetTrack<T>(TimelineAsset, string)
Gets a track of type T with the specified name.
Declaration
public static T GetTrack<T>(this TimelineAsset asset, string name) where T : TrackAsset
Parameters
| Type | Name | Description |
|---|---|---|
| TimelineAsset | asset | The instance of TimelineAsset to look into. |
| string | name | The name the TrackAsset has in Timeline. |
Returns
| Type | Description |
|---|---|
| T | Null when no matching track is found. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the track to look for. |