Input Loss, Despite Input being in Update.

Hello. I can’t seem to figure out how to deal with my problem. I have my input set to occur in the update part of the code and then all my physics stuff in the FixedUpdate. But I am still getting Input loss very commonly throughout the game. Please any help would be appreciated.

5310669–533829–PlayerMovement.cs (1.19 KB)

Post code directly in the future using CODE tags (like how I do it below). Try changing Update and FixedUpdate to the following and see if it fixes the issue.

    void Update()
    {
        if (Input.GetButtonDown("Jump"))
        {
            jump = true;
        }
    }

    void FixedUpdate()
    {
        playerMove();
        playerJump(jump);
        jump = false;
    }

From a quick glance you are setting jump to the value of Input.GetButtonDown each frame, but there can be multiple frames between each FixedUpdate. So you can have a frame with it set to true, then another setting it to false, then a FixedUpdate which sees jump as false, so no jump occurs. Just set it to true in Update, no matter how many frames occur, and only set it back to false in FixedUpdate after you have jumped.

You also don’t need to be multiplying velocity by Time.deltaTime in methods you call from FixedUpdate, as Time.deltaTime is a fixed value, unless you have gone insane and are routinely changing the fixed time step at runtime :stuck_out_tongue: Also I don’t know why you are setting the local variable inputJump to false after you use it. You’re not using it again in the playerJump method. Not hurting anything, but just pointless. It is a value type, so you’re not changing the value of the original “jump” variable when you do that.