First when I try to press the button it doesn’t do anything noticeable and I want to be able to hold it. Heres my code and I do have a gameobject set up not included.
public Vector3 RightForce = new Vector3(5, 0);
public Vector3 leftforce = new Vector3(-5, 0);
public Vector3 Jumpforce = new Vector2 (0, 3);
public int health = 3;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void Right (){
GetComponent<Rigidbody2D>().AddForce(RightForce);
}
public void Left(){
GetComponent<Rigidbody2D> ().AddForce (leftforce);
}
public void Jump(){
GetComponent<Rigidbody2D> ().AddForce (Jumpforce);}
Script 2 I have this one on one of my buttons
public MoveScript Move;
// Use this for initialization
void Start () {
}
void OnMouseDown(){
Move.Left();}