The script is set up, works great. The only thing is, when you press crouch button, you must hold it down. How can I make it so that you can toggle the crouch (Stay in crouch until button pressed again)?
I am using input manager.
if (Input.GetButtonDown("Crouch") && !crouching) {
collider.height = 1.5;
collider.center = Vector3 (0, -0.25, 0);
crouching = true;
}
if(Input.GetButtonUp("Crouch") && crouching){
collider.height = 2.0;
collider.center = Vector3 (0, 0, 0);
crouching = false;
}