Touchscreen with buttons

Hello,

I started off with keyboard controls, but I need to change to touchscreen. However, I don’t know how to go about doing this, as changing my movement script will impact my game and cause me to restart which I really do not want to do at this point. Any advice or help? Here is my movement script
I was thinking of adding buttons to the screen and on button click the player would move or jump accordingly.

    void FixedUpdate()
    {
        float move = Input.GetAxis("Horizontal");
//Movement
        if (Input.GetKey("right")) rb.velocity = new Vector3(move * runSpeed, rb.velocity.y, 0);
        if (Input.GetKey("left")) rb.velocity = new Vector3(-move * -runSpeed, rb.velocity.y, 0);
  //Jumping
        if (Input.GetButton ("Jump") && isGrounded()) {
            anim.SetTrigger ("isJumping");
            rb.velocity = new Vector3 (rb.velocity.x, jumpHeight, 0);
        }
    }

Many thanks

Hi…You can use Input.touch to achive that.

for example:

 if (Input.touchCount > 0 && Input.touchCount < 3)
        {
            foreach (Touch touch in Input.touches)
            {
                if (touch.position.x < Screen.width / 2)
                {
                    if (touch.phase == TouchPhase.Moved)
                    {
                     
                      
                      
                     //some actions here




                    }
         }
      }
}

Thanks, will try it out after i look it up.