What is Time.deltaTime and how does it work?

Published: (December 10, 2025 at 09:42 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for What is Time.deltaTime and how does it work?

What is Time.deltaTime?

To understand Time.deltaTime, you first need to know what the Update() method is.
Update() is Unity’s main player‑loop method and is called every frame. Anything you place inside Update() runs each frame—commonly, character movement code.

If you write code that moves a character 1 unit when a button is pressed, the character will move a different distance on machines with different frame rates. The faster the machine, the more times Update() runs per second, and the farther the character travels.

The Real Problem: FPS

The root cause is Frames Per Second (FPS).

  • Higher FPSUpdate() is called more often → character moves more times per second → faster movement.
  • Lower FPSUpdate() is called fewer times per second → slower movement.

Time.deltaTime solves this by providing the time (in seconds) elapsed since the last frame. Multiplying movement by Time.deltaTime converts per‑frame movement into per‑second movement, ensuring consistent behavior across different hardware.

How does it work?

Example 1: Without Time.deltaTime

MachineFPSMovement per frameMovement per second
Slow PC601 unit60 × 1 = 60 units
Fast PC1201 unit120 × 1 = 120 units

Result: Faster machines move the character faster — undesirable.

Example 2: With Time.deltaTime

MachineFPSTime.deltaTime (s)Movement per frame (1 × deltaTime)Movement after 1 s
Slow PC60≈ 0.016660.01666 units0.01666 × 60 = 1 unit
Fast PC120≈ 0.008330.00833 units0.00833 × 120 = 1 unit

Result: Consistent character movement regardless of FPS.

How to use it

Simply multiply any per‑frame value (e.g., speed) by Time.deltaTime inside Update():

// Move forward at 1 unit per second
transform.Translate(Vector3.forward * 1f * Time.deltaTime);

// Or using a custom speed variable
transform.position += movementSpeed * Time.deltaTime * transform.forward;

Key Takeaway

When performing operations in Update() that should be frame‑rate independent, always use Time.deltaTime. Avoid time‑based movement without it unless you intentionally want behavior to vary with the machine’s performance.

Back to Blog

Related posts

Read more »

Unity MiniFutbol

1. Maydon poli Plane - Hierarchy → Right‑click → 3D Object → Plane - Inspector settings: - Name: Ground - Position: X = 0, Y = 0, Z = 0 - Scale: X = 2, Y = 1,...