So, I’ve coded in this simple code to implement coyote time. However, I’ve been getting this bug which causes my player to double jump, I’ve been trying to fix it for the last few hours and I still have no clue what to do.
if(Input.GetKeyDown(_inputManager.jumpKey)){
_jumpBufferValue = _jumpBuffer;
}
if(_jumpBufferValue > 0 && _coyoteTimeValue > 0){
_jumpBufferValue = 0f;
_coyoteTimeValue = 0f;
Jump();
}
//////////////////////////////////
if(_isGrounded){
_coyoteTimeValue = _coyoteTime;
}
if(!_isGrounded){
_jumpBufferValue -= Time.deltaTime;
_coyoteTimeValue -= Time.deltaTime;
}
I’ve tried setting the coyote time to 0 but it is still not working, anyway thanks!