You can use the following
foreach (string choiceText in m_PlayerConversant.GetChoices())
{
GameObject choiceButton = Instantiate(m_ChoicePrefab, m_ChoiceRoot);
choiceButton.GetComponentInChildren<TextMeshProUGUI>().text = choiceText;
}
instead of
foreach (string choiceText in m_PlayerConversant.GetChoices())
{
GameObject choiceInstance = Instantiate(m_ChoicePrefab, m_ChoiceRoot);
var textComp = choiceInstance .GetComponentInChildren<TextMeshProUGUI>().text = choiceText;
textComp.text = choiceText;
}
It only saves one line but it’s still a bit shorter Hope it helps.