public void DisplayData() { StopAllSpawnCoroutines(); DestroyAllSpawnedPrefabs(); List <RacialEthnicGroupInfo> info = LoadData.GetData(_currentYear); int i = 1; foreach (RacialEthnicGroupInfo group in info) { // Set the text for each label DataPanel.GroupLabelFromRacialEthnicGroup(group.racialGroup).Count.text = group.employmentNumbers[jobType].ToString("#,##0"); // Calculate & label percent float percent = (float)group.employmentNumbers[jobType] / LoadData.GetTotalEmployment(jobType, _currentYear); TMP_Text percentLabel = DataPanel.GroupLabelFromRacialEthnicGroup(group.racialGroup).Percent; percentLabel.text = $"({(int) (percent * 100)}%)"; // Set color by percent percentLabel.color = Color.Lerp(Color.red, Color.green, percent); // Start the spawning coroutine IEnumerator spawnCoroutine = SpawnPrefabs(group.racialGroup, group.employmentNumbers[jobType], i); StartCoroutine(spawnCoroutine); _spawnCoroutines.Add(spawnCoroutine); i += 1; } }