Varible jump heights

In my 2D game, I’m trying to add variable jump heights but I’m having trouble how to achieve this effect.

Here is my script:

using UnityEngine;
using System.Collections;

public class PlayerControl : MonoBehaviour 
{
	private CharacterController controller;

	private float verticalVelocity;
	private float movement = 1.0f;

	public bool runControl = false;
	public float gravity = 60.0f;
	public float speed = 30.0f;
	public float jumpForce = 32.0f;
	public float shortJumpForce = 10.0f;
	public float soundVolume = 0.75f;

	private AudioSource source;
	public AudioClip jump;

	public static bool moving = true;

	void Start()
	{
		source = GetComponent<AudioSource>();
		controller = GetComponent<CharacterController> ();
	}

	void Update()
	{
		if (controller.isGrounded) 
		{
			verticalVelocity = -gravity * Time.deltaTime;

			if (Input.GetMouseButtonDown (0)) 
			{
				source.PlayOneShot (jump, soundVolume);
				verticalVelocity = jumpForce;
			}
		}

		else
		{
			verticalVelocity -= gravity * Time.deltaTime;
		}

		if (moving)
			movement = 1;
		else
			movement = 0;
			
		Vector2 moveVector = new Vector2(0,verticalVelocity);

		if (runControl) 
		{
			moveVector.x = movement * speed;
		}

		controller.Move(moveVector * Time.deltaTime);

	}
}

Thank you for the help.

All you need to do is check if the player is holding down the jump input and make the player jump during that time with a cap on it; here is a fully commented example:

using UnityEngine;
using System.Collections;
 
public class PlayerControl : MonoBehaviour {
    private CharacterController controller;
 
    private float verticalVelocity;
    private float movement = 1.0f;
 
    public bool runControl = false;
    public float gravity = 60.0f;
    public float speed = 30.0f;
    //This variable is for how high/powerful the jump is.
    public float jumpForce = 10.0f;
    //This variable is for how long the player can hold down jump for.
    public float maxJumpHeight = 0.5f;
    public float soundVolume = 0.75f;
    private float jumpInputTime = 0f;
 
    private AudioSource source;
    public AudioClip jump;
 
    public static bool moving = true;
 
    void Start()
    {
        source = GetComponent<AudioSource>();
        controller = GetComponent<CharacterController> ();
    }
 
    void Update() {
        //Checks to see if the player is holding down the mouse button and that the player is on the ground or already jumping.
        if ((controller.isGrounded == true || jumpInputTime > 0f) && Input.GetMouseButton(0)  && jumpInputTime < maxJumpHeight) {
            //Increases the time that the player is holding down the mouse input.
            jumpInputTime += Time.deltaTime;
        }
        //Resets the jump input time if the player is not holding down the mouse button.
        else
            jumpInputTime = 0f;

        //Ensures that the player is jumping.
        if (jumpInputTime > 0f) {
            source.PlayOneShot (jump, soundVolume);
            verticalVelocity += jumpForce;
        }
        else {
            verticalVelocity -= gravity * Time.deltaTime;
        }
 
        if (moving)
            movement = 1;
        else
            movement = 0;
             
        Vector2 moveVector = new Vector2(0,verticalVelocity);
 
        if (runControl) 
        {
            moveVector.x = movement * speed;
        }
 
        controller.Move(moveVector * Time.deltaTime);
 
    }
}

I have created a Platformer game as well and I utilized a GUI Button for jumping and added this script to handle the Input. This is a simple version of the script Im running. I can send you that as well if you like. It pretty straight forward. When the button is pressedDown it jumps and if it is held it will jump higher depending on what you set the jumpTime to. And if you only Quick Click the button it will only jump to the set height. If I need to better explain this and how to implement please let me know. This was as close as I could get to a Mario like jump.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;

public class UIButtonPress : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerEnterHandler, IPointerExitHandler
{
    public static UIButtonPress instance;
    public PlayerScript thePlayer;
     public float jumpForce;
    public float jumpTime;
    public float jumpTimeCounter;


    [HideInInspector]
    public bool Pressed = false;


	public Rigidbody2D playerRigidbody;
 
    public UnityEvent onPressed;

    public bool isJumping;
 
    public void OnPointerDown(PointerEventData eventData)
    {
        Pressed = true;

    }
 
    public void OnPointerEnter(PointerEventData eventData)
    {
         Pressed = true;
    }
 
    public void OnPointerExit(PointerEventData eventData)
    {
         Pressed = false;
    }
 
    public void OnPointerUp(PointerEventData eventData)
    {
        Pressed = false;
    }


 void Start(){
	 playerRigidbody = FindObjectOfType<Rigidbody2D>();
         jumpTimeCounter = jumpTime;

 }
     void FixedUpdate()
    {
        if (Pressed)
        {
            // onPressed.Invoke();
		playerRigidbody.velocity = new Vector2 (playerRigidbody.velocity.x, jumpForce);
                thePlayer.stoppedJumping = false;
                isJumping = true;
        }

		if(Pressed)
        {
            //and your counter hasn't reached zero...
            if(jumpTimeCounter > 0)
            {
                //keep jumping!
                playerRigidbody.velocity = new Vector2 (playerRigidbody.velocity.x, jumpForce);
                jumpTimeCounter -= Time.deltaTime;
				
            }
			
        }

		if(!Pressed){
			jumpTimeCounter = 0;
                        isJumping = false;
		}

    }

    void CreateInstance(){
		
		if(instance == null){
			instance = this;
		}
		
	}
}