Hi Guys,
I have a GUI Button and i have set it, so when i press it i move my player. However i want my player to move when i hold my GUI Button down and stop when i let go of the GUI Button.
using UnityEngine;
using System.Collections;
public class Button : MonoBehaviour {
// Use this for initialization
private void Start () {
}
// Update is called once per frame
private void Update () {
}
private void OnGUI(){
if(GUI.Button(new Rect(15,15,100,50), "Go")){
transform.position += new Vector3(0.1f,0,0);
}
}
}
Thank You