Class TimelineNavigator
Interface to navigate through Timelines and SubTimelines for the Timeline window.
Inherited Members
Namespace: UnityEditor.Timeline
Assembly: Unity.Timeline.Editor.dll
Syntax
public sealed class TimelineNavigator
Remarks
TimelineNavigator gives you access to the Timeline window breadcrumbs functionality. Use it to programmatically dig into SubTimelines, navigate to parent Timelines or navigate Timeline Window breadcrumbs.
Methods
GetBreadcrumbs()
Gets the collection of SequenceContexts associated with the breadcrumbs shown in the TimelineEditorWindow.
Declaration
public IEnumerable<SequenceContext> GetBreadcrumbs()
Returns
| Type | Description |
|---|---|
| IEnumerable<SequenceContext> | The collection of SequenceContexts associated with the breadcrumbs shown in the TimelineEditorWindow, from the root context to the current context. |
Remarks
This operation can be expensive. Consider caching the results instead of calling the method multiple times.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The Window associated to this instance has been destroyed. |
GetChildContexts()
Gets the collection of child contexts that can be navigated to from the current context.
Declaration
public IEnumerable<SequenceContext> GetChildContexts()
Returns
| Type | Description |
|---|---|
| IEnumerable<SequenceContext> | The collection of child contexts that can be navigated to from the current context. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The Window associated to this instance has been destroyed. |
GetCurrentContext()
Gets the SequenceContext associated with the Timeline currently shown in the Timeline window.
Declaration
public SequenceContext GetCurrentContext()
Returns
| Type | Description |
|---|---|
| SequenceContext | The SequenceContext associated with the Timeline currently shown in the Timeline window. |
Remarks
Equivalent to TimelineNavigator.GetBreadCrumbs().Last()
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The Window associated to this instance has been destroyed. |
GetParentContext()
Gets the parent SequenceContext for the Timeline currently shown in the Timeline window.
Declaration
public SequenceContext GetParentContext()
Returns
| Type | Description |
|---|---|
| SequenceContext | The parent SequenceContext for the Timeline currently shown in the Timeline window if there is one; an invalid SequenceContext otherwise. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The Window associated to this instance has been destroyed. |
GetRootContext()
Gets the first SequenceContext in the breadcrumbs.
Declaration
public SequenceContext GetRootContext()
Returns
| Type | Description |
|---|---|
| SequenceContext | The first SequenceContext in the breadcrumbs. |
Remarks
Equivalent to TimelineNavigator.GetBreadCrumbs().First()
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The Window associated to this instance has been destroyed. |
NavigateTo(SequenceContext)
Navigates to a new SequenceContext.
Declaration
public void NavigateTo(SequenceContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| SequenceContext | context | The context to navigate to. |
Remarks
The SequenceContext provided must be a valid navigation destination.
Valid navigation destinations:
- The parent context returned by GetParentContext().
- The root context returned by GetRootContext().
- Any SequenceContext returned by GetChildContexts().
- Any SequenceContext returned by GetBreadcrumbs().
Note: This method cannot be used to change the root SequenceContext. To change the root SequenceContext, use SetTimeline(TimelineAsset).
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The Window associated to this instance has been destroyed. |
| ArgumentException | The context is not valid. |
| InvalidOperationException | The context is not a valid navigation destination. |