public void setSpawnTag() { totalWaves = 10; GameObject[] tempPoints; pointCount = 0; pathPoints = new AIPath(); string tag; tag = "0AI_Path1"; tempPoints = GameObject.FindGameObjectsWithTag(tag); pointCount = tempPoints.Length; pathPoints = new AIPath(pointCount); for (int i = 0; i < pointCount; i++) { pathPoints.setPoint(i, tempPoints[i].GetComponent<Transform>().position); } }