public void Prime() { repo = GetComponent <PersonRepository>(); foreach (Transform child in personList.transform) { GameObject.Destroy(child.gameObject); } foreach (KeyValuePair <int, Person> person in repo.People) { PersonElement element = (PersonElement)Instantiate(prefab); element.PrimeButton(person.Value); element.transform.SetParent(personList, false); } }
public void UpdatePeople() { foreach (Transform child in PeopleOnTrip.transform) { GameObject.Destroy(child.gameObject); } if (Trip != null) { foreach (KeyValuePair <int, Person> person in Trip.PeopleOnTrip) { PersonElement element = (PersonElement)Instantiate(PersonElementPrefab); element.PrimeButton(person.Value); element.transform.SetParent(PeopleOnTrip, false); } } }