- Home /
How to have user input behave the same through variable framerates?
We have a significant portion of our user input polling on Update(). When a user presses lets say the "W" key, the camera moves forward as long as our event is firing for that key.
Issue is when the frame rate varies the speed at which the camera moves varies as well. If we turn vsync off our frame rates go to ~4,000 FPS and the camera practically teleports around the map. How do we keep the user input limited to a specific framerate when the framerate of the game varies, to avoid behaviors that rely on user input from behaving differently.
I looked into fixedupdate, but it seems that that can cause keypresses to be missed entirely.
Are you multiplying the camera's movement by Time.deltaTime?
Answer by Raresh · Mar 14, 2015 at 11:53 PM
Use Time.deltaTime. It creates the effect of something that is multiplied by it is bound to the passing of time.