JumpToTime(ref TimerState, DiscreteTime)
Jumps a timer state to a specific time, without advancing the timer from the current time to that time.
Read time 1 minuteLast updated 4 hours ago
Definition
- Type: Method
- Namespace: Unity.Animations
- Assembly: UnityEngine.AnimationCoreModule
JumpToTime(TimerState, DiscreteTime)
public static void JumpToTime(this ref TimerState timerState, DiscreteTime time)
Parameters
The timer state to jump. The method changes this timer state.
The time to jump to, in the same unit as . The wrap mode of the timer decides what happens to a time outside the range.
TimerState.RangeRemarks
The jump doesn't count the skipped span as played: TimerState.PreviousTime and TimerState.Time both become the target time, and TimerState.DeltaTime becomes zero. When the wrap mode is WrapMode.Once or WrapMode.ClampForever, the timer clamps the target time to TimerState.Range. When the wrap mode is WrapMode.Loop or WrapMode.PingPong, the timer repeats or reflects the target time into the range. When the wrap mode is WrapMode.Default, the timer doesn't change the target time.
The time is a curve time, in the same unit as . When the wrap mode is , the timer moves to shifted by TimerState.CycleOffset times the duration of the range. Other wrap modes ignore the offset. For and , the jump sets TimerState.LoopCount to TimerState.PreviousLoopCount.
RangeLooptimeLoopPingPongA jump also resets the timer for event gathering: if the timer advances in the next TimerStateExtensions.Update, AnimationEventUtility.GatherAnimationEvents includes the animation events at the target time, once. The events between the old time and the target time aren't gathered.