Is It Bad To Have Your Jump In Update()?

Is it bad to have your jump in the Update() method/function? Currently I do, and everything seems to work correctly, but the reason why I’m asking is because I’m curious and I was wondering if there is any performance issues with that. Also, I recently changed my jump to if (grounded && Input.GetMouseButtonDown(0)) {, and it works fine, but when I press the pause button the Player obviously jumps a little, but when I press the resume button the Player goes flying in the air, hits the top wall, and dies. Why is that? Does the Update have anything to do with it? Since my pause button uses Time.timeScale the Update is not affected so that’s why I ask this question.

I’m no expert (in fact i’m quite green behind the ears) but things like “Jump” should be in the FixedUpdate function.

A lot depends on how you jump. General rules

  • Everything that uses physics or RigidBody should go in FixedUpdate
  • Everything in update gets called every frame, so should be as efficient as possible
  • Anything that needs to be affected by timescale should use Time.deltaTime

It is just a matter of experimentation of Update and FixedUpdate because it dependes in a lot of factors. It is relative to the amount of code and the Unity Settings in Time and Physx. If you are aiming to mobile then just build and take notes of your results.

About the Time.timeScale not affecting Update it is wrong. Time.timeScale affects EVERYTHING in the Unity Universe.