converting standalone code to work on android

hey all.

i am new to scripting and i am making a game for mobile devices.
i have made a very basic ladder script with the help of youtube.
it works well with a standalone (using up and down arrows to move up and down the ladder) but i would like to put it into an android game so that when you touch a button you can go up it and when you let go of the button you fall back down.

my question is how would i rewrite the script to work with button touch, i have tried using getbuttondown instead of getkeydown but when i do this the character only moves a tiny bit and doesnt go up the ladder at all.

any help would be greatly appreciated :slight_smile:

this is my script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Ladder : MonoBehaviour {

public float speed = 6;
// Use this for initialization
void Start () {

// Update is called once per frame
void Update () {

void OnTriggerStay2D(Collider2D other)
	if (other.tag == "Player" && Input.GetKey (KeyCode.UpArrow)) {
		other.GetComponent<Rigidbody2D> ().velocity = new Vector2 (0, speed);
	} else if (other.tag == "Player" && Input.GetKey (KeyCode.DownArrow)) {
		other.GetComponent<Rigidbody2D> ().velocity = new Vector2 (0, -speed);
	} else 
		other.GetComponent<Rigidbody2D> ().velocity = new Vector2 (0, 1);


That code will only work on a standalone platform.

Here’s for Mobile For Mobile Movement