Hi, fellow Unity developers!
As a new Unity user, I’m pretty inexperienced with code, meaning that when I get a chance to see some, it’s pretty confusing to me. After seeing a bit of code from the tutorials I was wondering where I would put time.delta.time?
I know that it’s used to change from updating every frame to a more consistent speed, but do I always use that after I make a script relating to speed for any GameObject? Or is once enough?
I would explain it like that:
Time.deltatime makes it “per second”.
If you player moves with the speed 1 for example.
It will do it PER FRAME. But we don’t want that. We want the same experience on every device.
So we wan’t that speed per second. (speed * Time.deltatime)
You can also use it for a countdown:
Timer = Timer - Time.deltatime;
@Anxiety3D Time.deltatime means that if your game slows down, whatever its on doesn’t all of a sudden speed up and go really fast. For example, if you had it with your player movement and suddenly your game slowed down, when it loaded it wouldnt speed up and make your player go super fast. I reccomend using Time.deltatime most of the time when making player movement, or making shoot, etc.