Question by
BusaniX · Jul 13, 2019 at 07:18 PM ·
c#inputgetkeydown
GetKeyDown not always registering
Hi! I made a jump function to my FP controller but Input.GetKeyDown doesn't work 100 of the time I press it. Any ideas? Thanks!
void Jump()
{
yMove += jumpSpeed;
}
// Update is called once per frame
void Update()
{
if (cc.isGrounded)
{
yMove = 0;
// if grounded and press space, jump
if (Input.GetKeyDown(KeyCode.Space)) Jump();
}
else yMove += gravity * Time.deltaTime;
// other stuff
Comment
Answer by toske_ · Jul 20, 2019 at 03:05 PM
it seems like you cant move if its grounded, but can jump. when is the isGrounded false so that the if statement can turn to the else section ?
Your answer
![](https://koobas.hobune.stream/wayback/20220612204830im_/https://answers.unity.com/themes/thub/images/avi.jpg)