I think you are messing up yourself for a simple thing like jumping. I didn’t test your code but it seems that you are trying to control gravity too? If i understanded you use this line “velocity.y -= gravity * Time.deltaTime” to push down the character like gravity does? If yes you don’t need that because Unity already applies physic like this so if you put a rigid body to your character it will depends on physics so when it’s in air it will go down automatically. You shouldn’t use transform to move your character because you will have problems with collisions too, use rigid body instead. With rigid body you will only need
if (Input.GetButtonDown(“Jump”) && isGrounded)
{
Debug.Log(“jumping”);
velocity.y = jumpHeigth;
}
Also don’t use rigid body inside Update(), use FixedUpdate()