Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug text colour no changing

Discussion in 'UGUI & TextMesh Pro' started by JimWebs, Apr 8, 2024.

  1. JimWebs

    JimWebs

    Joined:
    Aug 2, 2023
    Posts:
    133
    Having a problem changing text colour via script. Should be pretty simple. All I'm doing is this:

    Code (CSharp):
    1. message_box.GetComponent<TMPro.TextMeshProUGUI>().color = new Color(0f, 127f, 212f, 255f);
    I've got the textmeshpro "color mode" set to single not gradient. Tried changing vertex color. Didn't work either.
    I can change it in inspector during game view, but as I say it won't change via script. I've checked everywhere that I'm not changing it somewhere else. I'm not.

    Any ideas?
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    8,409
    AlexandreT-unity and Spy-Master like this.
  3. JimWebs

    JimWebs

    Joined:
    Aug 2, 2023
    Posts:
    133
    AlexandreT-unity likes this.