InvokeRepeating OR Update OR FIxedUpdate?

I’m basically thinking to avoid modifying every calculation with Time.deltaTime, could I just do an InvokeRepeating and haveit run at 30 or 60 fps (or whatever works) instead of putting time sensitive stuff in Update? ALternatively, while UT recommends using FixedUpdate for physics, could/should I use FixedUpdate to handle every other time sensitive calculation as well?

Hey JTSmith,

Don’t be afraid of your friend Time.deltatime. Computer are super fast and doing that very simple math will not in that slightest have an effect your framerate. Using Invoke repeating would have more overhead then using your own timer system.

One thing that sucks about InvokeRepeating is that you have no control when it is really called (ie. [After/before/during] Update, [After/before/during] animations, [After/before/during] FixedUpdate). This does not sound like an issue but you have you other classes that depending on the function being called before they update on the same frame you might be out of luck.

What I suggest is making a simple timer class that you can use over and over again to call your functions. If you know how to use Delegates this is super easy to do.

Let me know if you have any other questions.


Hope im getting the gist of this JTSmith,

time.deltatime can be used in update or fixed update. deltaTime is the time difference between calls be it fixedupdate or update.

as far as I understand InvokeRepeating() uses a time difference in seconds, so therefore using deltatime behind the scenes based on your current target platform framerate to give you a call every x seconds.

certainly use fixedupdate for any physics movement etc, as update will not run in sequence with fixedupdate and you could get some shonky movement etc.

have a little look at the tutorial in the learn section, for a bit more info

im by no means any kind of expert but this is just what i interpret it to mean, if i understand it wrong then someone please correct me please :slight_smile:

dont want to lead you up the preverbial garden path.