How do I make my double jump input, stop right there with out any input until it touch ground

private void characterControler(){
isGrounded = p_Character.isGrounded;
outGrounded = p_Character != isGrounded;

        if (isGrounded && p_Velocity.y < 0){
            p_Velocity.y = 0f;
        }
        
        Vector2 movement = MovementControl.action.ReadValue<Vector2>();
        Vector3 move = new Vector3(movement.x, 0f, movement.y);
        move = cameraMain.forward * move.z + cameraMain.transform.right * move.x;
        move.y = 0f;
        p_Character.Move(move * Time.deltaTime * walkSpeed);
        
        if (JumpControl.action.triggered && isGrounded){
            p_Velocity.y += Mathf.Sqrt(jumpHeight * -3f * gravityValue);
            Debug.Log("Space or A / X , has Pressed");
        }
        else if (JumpControl.action.triggered && outGrounded){
            p_Velocity.y += Mathf.Sqrt(jumpHeight * -3f * gravityValue);
            Debug.Log("Space or A / X , has Pressed 2x Times");
        }

my Bollean

[Header("Boolean")]
    [SerializeField]
    private bool isGrounded;
    [SerializeField]
    private bool outGrounded;

Right Took me a while to fix this, but I’m actually resolve it by my self again…

what I did it just make a 2 input event’s on the outside of the input
JumpControl.action.started += press_Jump
JumpControl.action.started += double_press_Jump

and make a void for each dedicated input I do.

with a void press_Jump(InputAction.CallbackContext ctx)

and void double_press_Jump(InputAction.CallbackContext ctx)

p_Character it do to check the isGrounded also outGrounded

and now work like a charm!


here are the Code

private void characterControler(){
        isGrounded = p_Character.isGrounded;
        outGrounded = p_Character != isGrounded;
        
        if (isGrounded && p_Velocity.y < 0){
            p_Velocity.y = 0f;
        }
        
        Vector2 movement = MovementControl.action.ReadValue<Vector2>();
        Vector3 move = new Vector3(movement.x, 0f, movement.y);
        move = cameraMain.forward * move.z + cameraMain.transform.right * move.x;
        move.y = 0f;
        p_Character.Move(move * Time.deltaTime * walkSpeed);
        
        JumpControl.action.started += press_Jump;
        JumpControl.action.started += double_press_Jump;

        void press_Jump(InputAction.CallbackContext ctx){
            if (isGrounded && p_Character){
                JumpControl.action.performed -= press_Jump;
                JumpControl.action.canceled -= press_Jump;

                anim.SetBool("isJump", true);
                p_Velocity.y += Mathf.Sqrt(jumpHeight * -3f * gravityValue);
                Debug.Log("Space or A / X , has Pressed");
            }
        }

        void double_press_Jump(InputAction.CallbackContext ctx){
            if (outGrounded && p_Character){
                JumpControl.action.performed -= double_press_Jump;
                JumpControl.action.canceled -= double_press_Jump;

                anim.SetBool("isDJump", true);
                p_Velocity.y += Mathf.Sqrt(jumpHeight * -2f * gravityValue);
                Debug.Log("Space or A / X , has Pressed 2x Times");
                JumpControl.action.Disable();
            }
        }
        if (isGrounded){
            JumpControl.action.Enable();
        }
        
        p_Velocity.y += gravityValue * Time.deltaTime;
        p_Character.Move(p_Velocity * Time.deltaTime);