Unity3D Jump Not working on press a

Hi I have a sphere that has rigidbody and ground ( both has colliders ), When I press space it doesn’t work
I implemented this script:

public class PlayerScript : MonoBehaviour
{
    /* 
   Assgined with Player
   Feel free to edit or take this code in other assets :)
   */

    float forceSpeed = 15.0f;
    float jumpForce = 5.0f;
    bool isTouchGround = true;
    Rigidbody rb;
    private void Start()
    {
        rb = this.GetComponent<Rigidbody>();
    }
    private void FixedUpdate()
    {

        float moveHorizontal = Input.GetAxis("Horizontal");

        Vector3 move = new Vector3(moveHorizontal, 0.0f, 0.0f);
        rb.AddForce(move * forceSpeed * 25.0f * Time.deltaTime);
    }

    private void Update()
    {
        if (isTouchGround)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                rb.AddForce(Vector3.up * jumpForce);
            }
        }
    }
  
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Ground")
        {
            isTouchGround = true;
        }
    }

    void OnTriggerExit(Collider other)
    {
        if (other.gameObject.tag == "Ground")
        {
            isTouchGround = false;
        }
    }
}

Hi @harethtvalomer, there are so many ways things like this can go wrong. Can you put a Debug.Log(“got a space press”) immediately before the rb.AddForce statement to make sure your key press is registering?

Verfiy that first, and from there:

  1. make sure jumpForce has a value (debug it too) and that it is large enough. A one-shot AddForce like that might need to be big. Either that or use ForceMode.Impulse to give it a larger immediate push

  2. make sure your rigidbody isKinematic is not turned on

  3. check the mass of your rigidbody

  4. check that drag or any friction physic material you may have applied is not interfering.

  5. what else? could be more factors involved, like if you had a rigidbody that is a child of a gameOjbect that also has a rigidBody…