In my GameManager script I instantiate my ground from an array like so:
Instantiate(lands[0], landSpawn, Quaternion.identity); //ADD LAND
and I move the land like so in my LandController script like so:
void Update ()
{
transform.Translate(Vector3.left * speed * Time.deltaTime, Camera.main.transform);
}
It works and the land moves. But in my GameManager script in the Update I’m trying to track the lands position like so:
Debug.Log(lands[0].transform.position.x);
if (lands[0].transform.position.x < 0)
{
Debug.Log("land pass x < 0");
}
When I do this the Debug.Log just shows the object remaining at 0 (where I spawn it) even though it is actually changing position from my LandController script.
What’s going on?