How to use On-Screen Buttons in unity 5 {URGENT}

Hello dear Forum, I have a question about the game I am currently developing. Its a ball game and the aim is that the ball moves to the end, my only problem is that I cant seem to find a suiting way to use On screen touch buttons, so that I can use my App on a mobile device, because at the moment I can only use “WASD” So if you could find a way to fix my Script (Attached Below), so that I can add buttons to move my ball for mobile that would be really helpful. This is the Script that is linked to my Ball object. Any reply would be great! P.S. I’m not the best at coding Thanks in the future.

IT WOULD MEAN A LOT IF YOU COULD HELP ME…

#pragma strict

var rotationSpeed = 100;
var jumpHeight = 0.1;

var Hit01 : AudioClip;
var Hit02 : AudioClip;
var Hit03 : AudioClip;

var distToGround : float;

function Start() {
	distToGround = GetComponent.<Collider>().bounds.extents.y;
}

function Update () 
{
	
	//Handel ball roation (right; left) 
	var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
	rotation *= Time.deltaTime;
	GetComponent.<Rigidbody>().AddRelativeTorque (Vector3.back * rotation);

	if (Input.GetKeyDown(KeyCode.UpArrow) && IsGrounded ())
	
	{
		GetComponent.<Rigidbody>().velocity.y = jumpHeight;
	}
}

function IsGrounded () : boolean {
	return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1);
}

function OnCollisionEnter () {
	var theHit = Random.Range(0, 3);
	if (theHit == 0)
	{
		GetComponent.<AudioSource>().clip = Hit01;
	}
	else if (theHit == 1)
	{
		GetComponent.<AudioSource>().clip = Hit02;
	}
	else {
		GetComponent.<AudioSource>().clip = Hit03;
	}
	GetComponent.<AudioSource>().pitch = Random.Range (0.9,1.1);
	GetComponent.<AudioSource>().Play();
}

HERE IS HOW TO DO IT IN DETAIL:

first of, create a player gameobject, and attach the script to it: the script is posted below

then create a button UI object and go to it’s OnClick tab, and assign player gameobject as the target.

then click on the dropdown menu there and locate the jumpPlayer method. this means whenever the button is clicked the following method of the following target will execute!

now if everything is right, it should work in mobile too.

clicking the button with a mouse or a touch pressing should execute the method and make the player jump.

HERE IS THE FULL SCRIPT:

#pragma strict
#pragma strict
 
  @Header ("Player Settings")
 var rotationSpeed = 100;
 var jumpHeight = 0.1;
  var distToGround : float;
  
 @Header ("Player Hit Audio")
 var Hit01 : AudioClip;
 var Hit02 : AudioClip;
 var Hit03 : AudioClip;
 
 @Header ("Movement Setting")
 var forwardVelocity : float = 5;
 var backwardVelocity : float = -5;
 
@HideInInspector
 var player_rigidbody : Rigidbody ;

 
 function Start() {
     distToGround = GetComponent.<Collider>().bounds.extents.y;
     player_rigidbody = GetComponent.<Rigidbody>(); // Get this objects rigidbody
 }
 
 function Update () 
 {
     
     //Handel ball roation (right; left) 
     var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
     rotation *= Time.deltaTime;
     GetComponent.<Rigidbody>().AddRelativeTorque (Vector3.back * rotation);
 
     if (Input.GetKeyDown(KeyCode.UpArrow) && IsGrounded ())
     {
         playerJump();
     }
     if (Input.GetKey(KeyCode.LeftArrow))
     {
         playerMove(-1);
     }
     else if(Input.GetKey(KeyCode.RightArrow))
     {
     	playerMove(1);
     }
     
 }
 
 function playerJump(){
 if (IsGrounded ())
      
      {
          GetComponent.<Rigidbody>().velocity.y = jumpHeight;
      }
 }
 
 function playerMove(Dir : int){
        var rVel : Vector3 = player_rigidbody.velocity;
        rVel.x = (Dir == 1) ? forwardVelocity : backwardVelocity;
        player_rigidbody.velocity = rVel;
 }
 
 
 function IsGrounded () : boolean {
     return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1);
 }
 
 function OnCollisionEnter () {
     var theHit = Random.Range(0, 3);
     if (theHit == 0)
     {
         GetComponent.<AudioSource>().clip = Hit01;
     }
     else if (theHit == 1)
     {
         GetComponent.<AudioSource>().clip = Hit02;
     }
     else {
         GetComponent.<AudioSource>().clip = Hit03;
     }
     GetComponent.<AudioSource>().pitch = Random.Range (0.9,1.1);
     GetComponent.<AudioSource>().Play();
 }

I HAVE UPDATED THE SCRIPT INCLUDING THE MOVEMENT FUNCTION!
the method is same when assigning to the move right and left UI button, in the dropdownmenu look for playerMove(int Dir) and assign it with the OnCLick.

ALSO YOU NEED TO ASSIGN A INTEGER VALUE. USE 1 OR -1 DEPENDING ON YOUR DIRECTION.

@killer zog This Script is the one that handles my movement. I can use the Jump with the up arrow or button, but I can only use left and right movement with the left and right arrows, and not the buttons, so if you could by any chance tweak the script to add a function or what ever, that would be great

#pragma strict
 #pragma strict
  
  var rotationSpeed = 100;
  var jumpHeight = 0.1;
  
  var Hit01 : AudioClip;
  var Hit02 : AudioClip;
  var Hit03 : AudioClip;

  var distToGround : float;
  
  function Start() {
      distToGround = GetComponent.<Collider>().bounds.extents.y;
	}
  
  function Update () 
  {
      
	 //Handel ball roation (right; left) 
      var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
      rotation *= Time.deltaTime;
      GetComponent.<Rigidbody>().AddRelativeTorque (Vector3.back * rotation);
  
		if (Input.GetKeyDown(KeyCode.UpArrow) && IsGrounded ())
      
      {
          playerJump();
      }
	}
  
  function playerJump(){
  if (IsGrounded ())
       
			{
           GetComponent.<Rigidbody>().velocity.y = jumpHeight;
       }
  }
  
	function IsGrounded () : boolean {
      return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1);
  }
  
  function OnCollisionEnter () {
		var theHit = Random.Range(0, 3);
      if (theHit == 0)
      {
          GetComponent.<AudioSource>().clip = Hit01;
      }
		else if (theHit == 1)
      {
          GetComponent.<AudioSource>().clip = Hit02;
      }
      else {
      GetComponent.<AudioSource>().clip = Hit03;
      }
      GetComponent.<AudioSource>().pitch = Random.Range (0.9,1.1);
      GetComponent.<AudioSource>().Play();
  }