void SpawnMechs(Team team, int mechLimit) { //List<Mech> mechs = new List<Mech>(); Squad squad = new Squad(team); for (int i = 0; i < mechLimit; i++) { //Fresh meat :3 //Except its like fresh metal. GameObject freshMech = Instantiate(mechPrefab); Mech mechScript = freshMech.GetComponent <Mech>(); mechScript.Squad = squad; //Each mech has a reference to their own squad. squad.AddMech(mechScript); //mechs.Add(mechScript); mechScript.PlayerType = team; if (team == Team.Player1) { freshMech.transform.position = player1SpawnPoints[i].transform.position; freshMech.transform.rotation = player1SpawnPoints[i].transform.rotation; } else if (team == Team.Player2) { freshMech.transform.position = player2SpawnPoints[i].transform.position; freshMech.transform.rotation = player2SpawnPoints[i].transform.rotation; } freshMech.transform.SetParent(transform); } squadController.AddSquad(squad); //return mechs; }