Class TimelinePlaybackControls
Use the TimelinePlaybackControls to manage the Timeline window's playback state, playhead location, and play range.
Inherited Members
Namespace: UnityEditor.Timeline
Assembly: Unity.Timeline.Editor.dll
Syntax
public sealed class TimelinePlaybackControls
Methods
GetCurrentFrame(Context)
Retrieves the location of the timeline playhead in frames.
Declaration
public int GetCurrentFrame(TimelinePlaybackControls.Context context = Context.Local)
Parameters
Type | Name | Description |
---|---|---|
TimelinePlaybackControls.Context | context | Use Context with a Sub-Timeline to specify whether the returned value is relative to the Sub-Timeline or the main Timeline. If the Timeline is not a Sub-Timeline, the context uses local time regardless of the specified context. |
Returns
Type | Description |
---|---|
int | The playhead location in frames. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Window associated with this instance has been destroyed. |
ArgumentException | The context is invalid. |
GetCurrentTime(Context)
Retrieves the location of the timeline playhead in seconds.
Declaration
public double GetCurrentTime(TimelinePlaybackControls.Context context = Context.Local)
Parameters
Type | Name | Description |
---|---|---|
TimelinePlaybackControls.Context | context | Use Context with a Sub-Timeline to specify whether the returned value is relative to the Sub-Timeline or the main Timeline. If the Timeline is not a Sub-Timeline, the context uses local time regardless of the specified context. |
Returns
Type | Description |
---|---|
double | The playhead location in seconds. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Window associated with this instance has been destroyed. |
ArgumentException | The context is invalid. |
GoToFirstFrame()
Moves the playhead to the first frame.
Declaration
public void GoToFirstFrame()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Window associated with this instance has been destroyed. |
GoToLastFrame()
Moves the playhead to the last frame.
Declaration
public void GoToLastFrame()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Window associated with this instance has been destroyed. |
NextFrame()
Moves the playhead to the next frame.
Declaration
public void NextFrame()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Window associated with this instance has been destroyed. |
Pause()
Pauses playback.
Declaration
public void Pause()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Window associated with this instance has been destroyed. |
Play()
Starts playback.
Declaration
public void Play()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Window associated with this instance has been destroyed. |
PreviousFrame()
Moves the playhead to the previous frame.
Declaration
public void PreviousFrame()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Window associated with this instance has been destroyed. |
SetCurrentFrame(int, Context)
Moves the playhead to a specific frame.
Declaration
public void SetCurrentFrame(int frame, TimelinePlaybackControls.Context context = Context.Local)
Parameters
Type | Name | Description |
---|---|---|
int | frame | The frame to move to. |
TimelinePlaybackControls.Context | context | Use Context with a Sub-Timeline to specify whether the specified frame is relative to the Sub-Timeline or the main Timeline. If the Timeline is not a Sub-Timeline, the context uses local time regardless of the specified context. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Window associated with this instance has been destroyed. |
ArgumentException | The context is invalid. |
SetCurrentTime(double, Context)
Moves the playhead to a specific time.
Declaration
public void SetCurrentTime(double time, TimelinePlaybackControls.Context context = Context.Local)
Parameters
Type | Name | Description |
---|---|---|
double | time | The time in seconds. |
TimelinePlaybackControls.Context | context | Use Context with a Sub-Timeline to specify whether the specified time is relative to the Sub-Timeline or the main Timeline. If the Timeline is not a Sub-Timeline, the context uses local time regardless of the specified context. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The Window associated with this instance has been destroyed. |
ArgumentException | The context is invalid. |