private void Start() { List <FactionModel> factions = factionData.GetAllFactionList(); foreach (var faction in factions) { GameObject button = (GameObject)Instantiate(buttonPrefab); button.GetComponentInChildren <Text>().text = faction.FactionName; button.transform.SetParent(panel, false); //button.GetComponent<Image>().sprite = faction.GetSpriteByFaction(faction); } }