Documentation

Unity Engine

Download Unity

Unity Engine

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

JumpToTime(TimerState, DiscreteTime)

public static void JumpToTime(this ref TimerState timerState, DiscreteTime time)

Parameters

timerState

The timer state to jump. The method changes this timer state.

The time to jump to, in the same unit as
TimerState.Range
. The wrap mode of the timer decides what happens to a time outside the range.

Remarks

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
Range
. When the wrap mode is
Loop
, the timer moves to
time
shifted by TimerState.CycleOffset times the duration of the range. Other wrap modes ignore the offset. For
Loop
and
PingPong
, the jump sets TimerState.LoopCount to TimerState.PreviousLoopCount.
A 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.