No, that’s only for physics and is generally bad practice to use as some kind of game speed limiter. To make a game framerate-independent, you use Time.deltaTime where appropriate.
That’s what he asked. FixedUpdate is the rate at which the physics engine runs. This isn’t a constant set-in-stone value. If you program all your game code using FixedUpdate, then eventually decide that physics really needs to run at a different rate, your code is screwed. Also, the Maximum Allowed Timestep would potentially make your code run slow in low framerate situations. Furthermore, if you have a relatively low physics framerate and a high framerate otherwise, then movement code in FixedUpdate would be jittery. It’s just a bad idea, period. The correct answer is to use Time.deltaTime.
He mentioned TimeStep specifically. Yes, those things you listed are true, but they are also common knowledge. We don’t know what he wants to do, so we shouldn’t make assumptions and tell him how to do what we don’t even know what he is doing. Do you walk up to people carrying a hacksaw and some wood, then tell them they have the wrong saw for the wood? Perhaps they are two different projects? Maybe he has metal he wishes to cut at the same place to where he is taking the wood.
Anyway, to make assumptions about his plans, and then tell him the “correct answer” is arrogant. Particularly when we have no idea what he wants to do.
But yes, you’re amazing and smart, women adore you.
The Unity equivalent of XNA’s GameTime is called Time (Unity - Scripting API: Time). As eric and ender already pointed out, the specific value you are looking for is Time.deltaTime (which should be equivalent to XNA’s GameTime.ElapsedGameTime).
Nice overreaction there. The question was simple and straightforward about making the game’s speed processor independent (see the very first sentence in this thread), and the answer is to multiply the desired variables by Time.deltaTime. FixedUpdate is for physics, and the reasons for not using it inappropriately apparently aren’t known as much as they could be, or else I wouldn’t see people making those mistakes (including myself at first, before I read about it). Leaving a message that just says “FixedUpdate” in response to the topic question isn’t doing anyone any favors.
Ok guys read carefully.
What I meant was that I want to have a consistent game speed (same game speed) on different processors.
Example :
Let’s say that I have an Intel Dual Core processor on one computer running a game at 2.2 GHZ.
I also have an Intel Dual Core processor on “another” computer which is runnng the same game at 3.2 GHZ.
Keep in mind that it is not a networked game.
Now,I want both of these computers to play the game at the same speed as possible. Even if the processor speeds are different.
I think that the Time.deltaTime is the way to go.
But how does this work actually,what does this Time.deltaTime actually do ?
With Time.deltaTime, you have a difference from the last update. So anything that is time sensitive must be multiplied by that value. It’s pretty easy. They won’t update at the same speeds, but if your math and methods are right, they will feel pretty much the same.