---
title: ToTimerState(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/clip/totimerstate
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/animations/clip/totimerstate.md
last_updated: 2026-11-30
generated_at: 2026-11-30T21:24:46.987Z
locale: en-us
---

# ToTimerState(DiscreteTime)

> Creates a timer for the clip, positioned at a time from the start of the clip.

## 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)

```csharp
public readonly TimerState ToTimerState(DiscreteTime time)
```

### Parameters

**** (\[DiscreteTime]\(/engine/7000.0/script-reference/unity/integertime/discretetime)): The time, in seconds, to advance the timer by from the start of the clip. A negative time goes backward.

### Returns

| Type                                                                         | Description                                |
| ---------------------------------------------------------------------------- | ------------------------------------------ |
| [TimerState](/engine/7000.0/script-reference/unity/animations/timerstate.md) | The timer of the clip, advanced by `time`. |

### Remarks

The timer is a clip timer. Its [TimerState.Time](/engine/7000.0/script-reference/unity/animations/timerstate/time.md) is the time on the clip curves, including the cycle offset. Its [TimerState.LoopCount](/engine/7000.0/script-reference/unity/animations/timerstate/loopcount.md) counts the wraps of the clip. Pass it to [TimerStateExtensions.Update](/engine/7000.0/script-reference/unity/animations/timerstateextensions/update.md) every frame to play the clip.

The timer has the following values:

* [TimerState.Range](/engine/7000.0/script-reference/unity/animations/timerstate/range.md) goes from [Clip.StartTime](/engine/7000.0/script-reference/unity/animations/clip/starttime.md) to [Clip.StopTime](/engine/7000.0/script-reference/unity/animations/clip/stoptime.md).

* [TimerState.WrapMode](/engine/7000.0/script-reference/unity/animations/timerstate/wrapmode.md) is [WrapMode.Loop](/engine/7000.0/script-reference/unityengine/wrapmode/loop.md) if [Clip.LoopTime](/engine/7000.0/script-reference/unity/animations/clip/looptime.md) is `true`, and [WrapMode.ClampForever](/engine/7000.0/script-reference/unityengine/wrapmode/clampforever.md) otherwise.

* [TimerState.CycleOffset](/engine/7000.0/script-reference/unity/animations/timerstate/cycleoffset.md) is the **Cycle Offset** of the clip if the clip loops, and 0 otherwise.

* [TimerState.TimeScale](/engine/7000.0/script-reference/unity/animations/timerstate/timescale.md) is 1, and the timer is playing.

* [TimerState.PreviousTime](/engine/7000.0/script-reference/unity/animations/timerstate/previoustime.md) 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](/engine/7000.0/script-reference/unity/animations/timerstate/timescale.md) on the timer.
