Function not working correctly inside FixedUpdate

Hi everyone, I hope you are doing well.
I would like to understand why the if statement inside my Function is not working in FixedUpdate. Thank you in advance for your help.

void FixedUpdate()

public void FunctionFastMove()

    if (Input.GetKeyDown(KeyCode.F))
        if (boolCanFastMove == true)
            Instantiate(gameObjectSmoke, transform.position, transform.rotation);
            componentRigidBody.AddForce(settingRotationDirection * settingFastMove, ForceMode.Impulse);
            boolCanFastMove = false;
            Invoke("FunctionFastMoveTrue", settingTimeToFastMove);


Any GetXXXDown function must not be used in FixedUpdate because they only return true for one frame. Since FixedUpdate usually does not run every frame (especially at high visual framerates) you essentially miss the “down event”. Input is processed / updated at the beginning of each frame. So the frame the key was pressed down, the xxxDown events would return true. The very next frame the method would return false again. Inside FixedUpdate you would need to be lucky that in the exact frame when the event happens a FixedUpdate call is scheduled.

When you have a visual framerate of 60 fps, about every 5th frame would be “missed” by FixedUpdate since that runs at 50 fps by default. When your game runs at 500 fps, you only get a FixedUpdate call roughly every 10 frames. So chances are pretty low to ever detect a xxxDown or xxxUp event.

FixedUpdate is exclusively for physics related stuff that happens over a longer period of time. So when you want to apply a continuous force, that should be done in FixedUpdate. Pretty much everything else should be in Update, even jumping. Yes, physics only updates when FixedUpdate is called, but you can add an impulse force in Update without any issues since it’s a one-time event.

if you talking about the Input statement than the problem is that GetKeyDown only runs one frame where it happens while fixedupdate either runs multiple times or zero times.

Best to do would be run getkeydown on update and set a controlbool there.