public void Begin() { Soldier[] existingSoldiers = GetComponentsInChildren <Soldier>(); foreach (Soldier oldSoldier in existingSoldiers) { Destroy(oldSoldier); } SpawnPosition[] points = spawnPoint.GetComponentsInChildren <SpawnPosition>(); Soldier[] newSoldiers = new Soldier[points.Length]; for (int i = 0; i < points.Length; i++) { SpawnPosition position = points[i]; Soldier newSoldier = (Soldier)Instantiate(soldier, position.transform.position, position.transform.rotation); newSoldier.transform.parent = this.transform; newSoldier.Begin(); newSoldiers[i] = newSoldier; } if (!isHuman) { aiController = new AI(this, newSoldiers); } started = true; }