cant jump after first double jump

After the first double jump, the player can not jump anymore.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour {

    public float speed;
    public float jumpForce;
    private float moveInput;

    private Rigidbody2D rb;

    private bool facingRight = true;
    private bool isGrounded;
    public Transform groundCheck;
    public float checkRadius;
    public LayerMask whatIsGround;

    private int extraJumps;
    public int extraJumpsValue;

void Start () {
        extraJumps = extraJumpsValue;
        rb = GetComponent<Rigidbody2D>();
		
	}
	
	// Update is called once per frame
	void FixedUpdate () {

        isGrounded = Physics2D.OverlapCircle(groundCheck.position, checkRadius, whatIsGround);

        moveInput = Input.GetAxis("Horizontal");
        Debug.Log(moveInput);
        rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);

        if(facingRight == false && moveInput > 0)
        {
            Flip();
        }
        else if(facingRight == true && moveInput < 0)
        {
            Flip();
        }
	}

    void Update()
    {
        if(isGrounded == true)
        {
            extraJumps = extraJumpsValue;
        }


        if (Input.GetKeyDown(KeyCode.UpArrow) && extraJumps > 0)
        {
            rb.velocity = Vector2.up * jumpForce;
            extraJumps--;
        } else if(Input.GetKeyDown(KeyCode.UpArrow) && extraJumps == 0 && isGrounded == true)
        {
            rb.velocity = Vector2.up * jumpForce;
        }

    }

    void Flip()
    {
        facingRight = !facingRight;
        Vector3 Scaler = transform.localScale;
        Scaler.x *= -1;
        transform.localScale = Scaler;

    }
}

Hi,
you have some buggy codes for jumping.
you didn’t mention whats the value of extrajumpsValue.i guess it’s 2.
if we tracing your code.
extrajump = 2; 2 > 0 => in seconds condition.
extrajump – => extrajump = 1;
the double jump :
1 > 0 => in seconds condition.
extrajump – => extrajump = 0;
so if is grounded == true when you jump again it must work.

so write debug.log in isgrounded == true condition to check if it’s hit that point or not.

be careful to add extraJumps–; in third condition too .(cause you are jumping there and you have just 1 jump left)

also you can delete the third section.these codes do every thing you want if is grounded(circle raycast) works fine!

    if(isGrounded == true)
         {
             extraJumps = extraJumpsValue;
         }
 
 
         if (Input.GetKeyDown(KeyCode.UpArrow) && extraJumps > 0)
         {
             rb.velocity = Vector2.up * jumpForce;
             extraJumps--;
         }