Hey guys, nooby dev here. I’ve been sitting here for hours trying to get his dang thing to work. Here’s the gist:
I want this space ship to move left,
When I press this text button.
Problem is, I can’t seem to find a way to “connect” the UI element with the GameObject.
Here’s my code:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class FindScript : MonoBehaviour {
private GameObject ship;
void Start () {
ship = GameObject.Find ("SSpaceship1"); //Finding the space ship
}
public void Update() {
//if(Input.??????????)
ship.rigidbody2D.AddForce(new Vector2(-12, 0));
}
}
I got nothin’. Can anyone here please be kind enough to point me where I’m going wrong with this?
Thanks in advance.