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<Sequence |
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 |
---|---|
Invalid |
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<Sequence |
The collection of child contexts that can be navigated to from the current context. |
Exceptions
Type | Condition |
---|---|
Invalid |
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 |
---|---|
Sequence |
The SequenceContext associated with the Timeline currently shown in the Timeline window. |
Remarks
Equivalent to TimelineNavigator.GetBreadCrumbs().Last()
Exceptions
Type | Condition |
---|---|
Invalid |
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 |
---|---|
Sequence |
The parent SequenceContext for the Timeline currently shown in the Timeline window if there is one; an invalid SequenceContext otherwise. Invalid |
Exceptions
Type | Condition |
---|---|
Invalid |
The Window associated to this instance has been destroyed. |
GetRootContext()
Gets the first SequenceContext in the breadcrumbs.
Declaration
public SequenceContext GetRootContext()
Returns
Type | Description |
---|---|
Sequence |
The first SequenceContext in the breadcrumbs. |
Remarks
Equivalent to TimelineNavigator.GetBreadCrumbs().First()
Exceptions
Type | Condition |
---|---|
Invalid |
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 |
---|---|---|
Sequence |
context | The context to navigate to. |
Remarks
The SequenceContext provided must be a valid navigation destination.
Valid navigation destinations:
- The parent context returned by Get
Parent .Context() - The root context returned by Get
Root .Context() - Any SequenceContext returned by Get
Child .Contexts() - Any SequenceContext returned by Get
Breadcrumbs() .
Note: This method cannot be used to change the root SequenceContext. To change the root SequenceContext, use Set
Exceptions
Type | Condition |
---|---|
Invalid |
The Window associated to this instance has been destroyed. |
Argument |
The context is not valid. |
Invalid |
The context is not a valid navigation destination. |