private void CheckRaceDataLists() { if (Application.isPlaying) { //Start will have cleared any EditorAdded Assets and we only *need* the ones in the library var raceDatas = thisDynamicRaceLibrary.GetAllRacesBase(); SetRaceLists(raceDatas); } else { //In this case we *need* all the races this setting *could* be so everything from the library, and asset bundles because the developer need to be able to set the race to be any of these var raceDatas = thisDynamicRaceLibrary.GetAllRaces(); if ((raceDatas.Length + 1) != (foundRaces.Count)) { SetRaceLists(raceDatas); } } }
// for populating list of races like populating other button lists public void GetAllRaces() { RaceData[] raceData = dynamicRaceLibrary.GetAllRacesBase(); foreach (GameObject go in raceButtons) { Destroy(go.gameObject); } raceButtons.Clear(); //had to do this temp for the dumb default races that have dcs added foreach (RaceData file in raceData) { if (file.raceName.Contains("Male") && file.raceName.Contains("DCS"))//had to do this temp for the dumb default races that have dcs added { GameObject newButton = Instantiate(RaceButtonPrefab); newButton.transform.SetParent(RaceButtonPrefab.transform.parent, false); newButton.name = "RACE-BUTTON-" + file.raceName; newButton.GetComponent <RaceLoadButton>().SetupButton(file.raceName.Substring(file.raceName.Length - 12, 5)); raceButtons.Add(newButton); newButton.SetActive(true); } else if (file.raceName.Contains("Male") && !file.raceName.Contains("DCS")) { GameObject newButton = Instantiate(RaceButtonPrefab); newButton.transform.SetParent(RaceButtonPrefab.transform.parent, false); newButton.name = "RACE-BUTTON-" + file.raceName; newButton.GetComponent <RaceLoadButton>().SetupButton(file.raceName.Substring(file.raceName.Length - 4, 4)); raceButtons.Add(newButton); newButton.SetActive(true); } } }