public void InitializeMeltGrid() { int[] tempStats; MeltableList.Clear(); SelectedToMeltList.Clear(); MeltableList = CharectorStats.heroesThatCanMelt(CharectorStats.getTempHero(), xpToBeAdded, SelectedToMeltList); if (GridButtonGameObjs.Count > 0) { foreach (GameObject button in GridButtonGameObjs) { Destroy(button.gameObject); } GridButtonGameObjs.Clear(); } for (int i = 0; i < MeltableList.Count; i++) { tempStats = CharectorStats.UnlockedCharector(MeltableList[i]); GameObject button = Instantiate(buttonTemplate) as GameObject; GridButtonGameObjs.Add(button); button.SetActive(true); button.GetComponent <EnhanceListButton>().SetText(CharectorStats.HeroName(tempStats[1])); button.GetComponent <EnhanceListButton>().SetHeroNum(tempStats[0]); button.GetComponent <EnhanceListButton>().SetIndex(i); button.transform.SetParent(buttonTemplate.transform.parent, false); } }