Search Unity

Resolved TextMeshProUGUI text disappears when there is a change in vertex color

Discussion in 'UGUI & TextMesh Pro' started by Jusrec, Aug 30, 2022.

  1. Jusrec

    Jusrec

    Joined:
    Oct 9, 2021
    Posts:
    2
    I'm trying to change text color by using a scriptable object called 'speaker'. I can update the text just by doing
    Code (CSharp):
    1. Text.text = "text"
    but whenever I try to change the color value it just disappears and I cannot get it back by changing values from inspector. How can I change the color by not messing up with the text?

    Here's the code:
    Code (CSharp):
    1. public TextMeshProUGUI barText;
    2. public TextMeshProUGUI personNameText;
    3.  
    4. personNameText.text = currentScene.sentences[sentenceIndex].speaker.name;
    5. personNameText.color = currentScene.sentences[sentenceIndex].speaker.textColor;
    6. Debug.Log(personNameText.color);
     
  2. Jusrec

    Jusrec

    Joined:
    Oct 9, 2021
    Posts:
    2
    Fixed!

    I was making the colors in speaker all transparent. Just maxxed the 'S' values.