ToTimerState(DiscreteTime)
Creates a timer for the clip, positioned at a time from the start of the clip.
Read time 1 minuteLast updated 4 hours ago
Definition
- Type: Method
- Namespace: Unity.Animations
- Assembly: UnityEngine.AnimationCoreModule
public readonly TimerState ToTimerState(DiscreteTime time)
Parameters
The time, in seconds, to advance the timer by from the start of the clip. A negative time goes backward.
Returns
Type | Description |
|---|---|
| TimerState | The timer of the clip, advanced by |
Remarks
The timer is a clip timer. Its TimerState.Time is the time on the clip curves, including the cycle offset. Its TimerState.LoopCount counts the wraps of the clip. Pass it to TimerStateExtensions.Update every frame to play the clip.
The timer has the following values:
-
TimerState.CycleOffset is the Cycle Offset of the clip if the clip loops, and 0 otherwise.
-
TimerState.TimeScale is 1, and the timer is playing.
-
TimerState.PreviousTime is the time where the clip starts, which is the start of the range plus the cycle offset when the clip loops.
The timer doesn't snap the time to the frames of the clip. To play a clip backward, set a negative TimerState.TimeScale on the timer.