make player jump when tap on screen
using UnityEngine;
using System.Collections;
public class Playercontroller : MonoBehaviour {
public float movespeed = 4f;
public float jumpspeed = 7f;
private Rigidbody2D myrigidbody;
// Use this for initialization
void Start () {
myrigidbody = GetComponent<Rigidbody2D> ();
}
// Update is called once per frame
void Update ()
{
myrigidbody.velocity = new Vector2 (movespeed, myrigidbody.velocity.y);
if (Input.GetKeyDown (KeyCode.Space) )
{
myrigidbody.velocity = new Vector2 (myrigidbody.velocity.x, jumpspeed);
}
}
}
I am using this script to make my player jump using space button . i need mobile touch to make my player jump i don't know how to do this.....so help me.
Comment
Your answer

Follow this Question
Related Questions
Unity game doesn't detect every click 0 Answers
Having problems with touch not working very well. 0 Answers
Android Touch Double Jump - Not working 0 Answers
Drag and Drop Touch Collision 1 Answer
Unity Input Touch 0 Answers