K
K
Konstantin Kitmanov2018-04-03 11:49:48
Unity
Konstantin Kitmanov, 2018-04-03 11:49:48

Why does Unity3D recommend reading input in Update and not FixedUpdate?

Update is called every frame. That is, if we read the input in Update, then the responsiveness of the control will depend on the FPS, right? I'd rather have my character keep moving and shooting, albeit blindly, even if there's a big fight on stage and the FPS drops to 15.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daniil Basmanov, 2018-04-03
@k12th

Because the Input values ​​are updated in Update. If you, for example, tie some code to Input.GetKeyDown, then it can work inside FixedUpdate several times for the same event. In general, you approach this from the wrong side, the responsiveness of the control in any case will depend on Update and what is displayed on the screen, if your FPS drops to 15, then you need to optimize the game, and not come up with crutches.

A
Ark Tarusov, 2018-04-03
@kreo_OL

Because Update happens every frame, and FixedUpdate is a fixed number of times, by default 30 times per second.
If the input is read in a fixed update, it will become unresponsive.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question