Why are some jump presses ignored?
void FixedUpdate() {
if (Input.GetKeyDown(KeyCode.Space)) Jump();
}
- GetKeyDown only works in menus
- FixedUpdate may not run that frame
- Space is reserved by the physics engine
- Jump() runs before input is read
GetKeyDown is true only for the rendered frame of the press; if no fixed step runs that frame, the press is missed. Read input in Update and apply it in FixedUpdate.
Play Game Dev ▸