public void SpawnTiles(int amount) { for (int i = 0; i < amount; i++) { GameObject go = Instantiate(groundTilePrefab); GroundTile gt = go.GetComponent <GroundTile>(); if (i < amount - 10) { gt.Initialize(new Vector3(i - 10, -5, 0)); } else if (i < amount - 5) { gt.Initialize(new Vector3(i - 15, -2, 0)); } else { gt.Initialize(new Vector3(i - 25, 1, 0)); } } }