I am trying to make a simple platformer game and the code for jumping is as follows.
private void FixedUpdate()
{
if(onPlatform && Input.GetMouseButtonUp(0))
{
rb.velocity = new Vector3(rb.velocity.x, jumpForce, 0);
Debug.Log("up");
onPlatform = false;
}
}
The Problem: When I try to jump, 1 out of 5 times it does not jump and does not print “up”.
I have no idea why and any help would be much appreciated.
,