Hi Everyone,
I’m a new developer here and I’m pulling my hair out. I’m trying to do something very simple, but it’s not working and I can’t figure out why! I’m trying to simply move an object from one location to another during runtime. Below is a sample of my code where I want to move the object “target” to location 0,0,0 when a touch occurs. Does anyone know what I’m doing wrong?
Thanks!
public class BackgroundTouch : MonoBehaviour {
public GameObject target;
// Use this for initialization
void Start () {
target = GameObject.Find("Target");
}
// Update is called once per frame
void Update () {
if (iPhoneInput.touchCount==0)
{
return;
}
target.transform.position = new Vector3(0,0,0);
}
}