Hello!
I am trying to get the position of the last gameobject in an array. What i get is the starting position only, not the updated one that i need. Very strange since i check for the position in the update function:
using UnityEngine;
using System.Collections;
public class TileGeneration : MonoBehaviour {
public GameObject plainTile;
public float x;
public float y;
public GameObject[] startTiles;
public Vector3 lastTilepos;
void Start () {
for (int i = 0; i < 6; i++)
{
startTiles *= plainTile;*
_ Instantiate (startTiles*,new Vector3(x,y,0),transform.rotation);_
_ x = x + 2.4f;_
_ }_
_ }*_
* void Update () {*
* lastTilepos = startTiles [startTiles.Length - 1].transform.position;*
* }*
}
Any ideas?
Thank you!