Hold Down GUIButton?

I am making my game for mobile and the one problem I have run into is making the button be able to be held down to continually run the script. It worked fine while I was using GetKeyDown to make it the player fly, but now when I press the button on screen it only keeps the script active for less than a second. I was wondering if someone could help me edit this script to make it so the script continually runs while the on screen button is held down. Sorry if this was confusing, English isn’t my first language.

public static float jumpDuration = 1.5f;
public float jumpForce = 10.0f;

public void BoostUp () {
    jumpDuration = Mathf.MoveTowards (jumpDuration, 0, Time.fixedDeltaTime);
    GameObject.Find ("Player").GetComponent<Rigidbody> ().AddForce (new Vector3 (0, jumpForce));

void OnCollisionEnter (Collision Col){
    if (Col.gameObject.tag == "Ground") {
        jumpDuration = 1.5f;
  1. Add an EventTrigger component to the button object.
  2. Add OnPointerDown and OnPointerUp events
  3. Create a script, implement Up and Down handlers and expose a boolean variable
  4. In the Down handler set an exposed variable to true
  5. In the Up handler set said exposed variable to false
  6. The exposed var is now reflecting the state of your button


public class Pointer : MonoBehaviour 
    public bool PointerDown
        private set;

    public void OnPointerDown()
        PointerDown = true;

    public void OnPointerUp()
        PointerDown = false;