---
title: Update(ref TimerState, DiscreteTime)
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/timerstateextensions/update
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/timerstateextensions/update.md
last_updated: 2026-11-30
generated_at: 2026-11-30T20:52:06.399Z
locale: en-us
---

# Update(ref TimerState, DiscreteTime)

> Advances a timer by a time step and applies its wrap mode.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Animations](/engine/7000.0/script-reference/unity/animations.md)
* **Assembly:** [UnityEngine.AnimationCoreModule](/engine/7000.0/script-reference/modules/unityengine-animationcoremodule.md)

## Update(TimerState, DiscreteTime)

```csharp
public static void Update(this ref TimerState timerState, DiscreteTime deltaTime)
```

### Parameters

**** (\[TimerState]\(/engine/7000.0/script-reference/unity/animations/timerstate)): The timer to update. The method changes this timer.**** (\[DiscreteTime]\(/engine/7000.0/script-reference/unity/integertime/discretetime)): The time step to advance the timer by, before the method multiplies it by [TimerState.TimeScale](/engine/7000.0/script-reference/unity/animations/timerstate/timescale.md).

### Remarks

The method first stores the current [TimerState.Time](/engine/7000.0/script-reference/unity/animations/timerstate/time.md), [TimerState.LoopCount](/engine/7000.0/script-reference/unity/animations/timerstate/loopcount.md), and [TimerState.PlayState](/engine/7000.0/script-reference/unity/animations/timerstate/playstate.md) as the previous values. [TimerState.PlayState](/engine/7000.0/script-reference/unity/animations/timerstate/playstate.md) then takes the value of [TimerState.NextPlayState](/engine/7000.0/script-reference/unity/animations/timerstate/nextplaystate.md).

If the timer isn't playing, [TimerState.DeltaTime](/engine/7000.0/script-reference/unity/animations/timerstate/deltatime.md) is zero and the time doesn't change. Otherwise, [TimerState.DeltaTime](/engine/7000.0/script-reference/unity/animations/timerstate/deltatime.md) is `deltaTime` multiplied by [TimerState.TimeScale](/engine/7000.0/script-reference/unity/animations/timerstate/timescale.md), and the method advances [TimerState.Time](/engine/7000.0/script-reference/unity/animations/timerstate/time.md) according to [TimerState.WrapMode](/engine/7000.0/script-reference/unity/animations/timerstate/wrapmode.md):

* [WrapMode.Loop](/engine/7000.0/script-reference/unityengine/wrapmode/loop.md) wraps the time around the range and updates the loop count.

* [WrapMode.PingPong](/engine/7000.0/script-reference/unityengine/wrapmode/pingpong.md) reverses the direction at each end of the range and updates the loop count.

* [WrapMode.Once](/engine/7000.0/script-reference/unityengine/wrapmode/once.md) moves the time to the opposite end of the range when it passes the end, and stops the timer on the next update.

* [WrapMode.ClampForever](/engine/7000.0/script-reference/unityengine/wrapmode/clampforever.md) clamps the time to the range.

* [WrapMode.Default](/engine/7000.0/script-reference/unityengine/wrapmode/default.md) advances the time without limit.
