public void PreparePeople(int n, int maxInfected) { if (n > peoplePool.Count) { n = peoplePool.Count; } //List<GameObject> result = new List<GameObject>(); for (int i = 0; i < n; i++) { // Preparing person PersonController pc = peoplePool[i].GetComponent <PersonController>(); pc.Clean(i < maxInfected); pc.transform.position = GenerateSpawnPosition(); peoplePool[i].SetActive(true); people.Add(peoplePool[i]); } }