Hello Shahar,
Time.deltaTime
is the time in seconds it took to complete the last frame.
Let’s say you have some code that detects for the pressing of a button to move a character in your Update
method. You want to move the character on the X-axis 10m per second. Update
is called once per frame, but on devices which render those frames either faster or slower than one frame per second, you will get varying results for the character’s movement. On very fast devices, a player may have an advantage by being able to move much more easily than a slower device. A slower device may have the character appear jittery and lose the smooth movement between frames, making a game unplayable.
As Update
is called once per frame, you can multiply the movement value of 10 by Time.deltaTime
, you would now be moving the character 10m per second rather than 10m per frame.
We could now say that your movement code is independent of the frame rate, it doesn’t matter if someone has a device capable of rendering the frames more quickly/slowly, as your rate of movement will be consistent on all devices.
I hope helps
See also;