Hello everyone,
I trying to make a dialogue system with textMeshPro and i struggle to have a visual update of the selected answers.
My first idea swa to incorpore an updatable variable (colorAnswerX) :
readonly string colorAnswer_unseleted = "<color=white>";
readonly string colorAnswer_seleted = "<color=yellow>";
public string colorAnswer1, colorAnswer2, colorAnswer3;
//Display answers
colorAnswer2 = colorAnswer3 = colorAnswer_unseleted;
colorAnswer1 = colorAnswer_seleted;
for (int i = 0; i < answers.Count; i++)
{
textMeshProUGUI.text += "\n";
if (i == 0)
answers[i] = colorAnswer1 + answers[i];
else if (i == 1)
answers[i] = colorAnswer2 + answers[i];
else if (i == 2)
answers[i] = colorAnswer3 + answers[i];
textMeshProUGUI.text += answers[i];
}
However when i update for exemple colorAnswer2 the text color don’t change.
The problem is that the textMeshProUGUI.text isn’t updated but how can i do to change my answers color?