Search Unity

Question Which API should I call to set the color of a TextMeshPro text in Trigger ?

Discussion in 'UGUI & TextMesh Pro' started by Erenquin, May 24, 2021.

  1. Erenquin

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
    Hello,
    the title says it all.

    Which function can I call there to change the font color ? (Similarly to the text change you can see in the 2nd event).

    upload_2021-5-24_15-8-59.png

    Thanks.
     
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    what about
    TextMeshProUGUI.color
    ?
     
  3. Erenquin

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
    Thanks for the answer.
    I updated to the latest version of TextMeshpro and looked again but still do not see it in the list.
     
  4. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Is your assigned "Text (TMP)" object of type TextMeshProUGUI (is it part of the UI) or is it a 3D text in the scene?
     
  5. Erenquin

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
    It is the text component of a button, which itself is a "Button - TextMeshpro"
    upload_2021-5-26_19-41-44.png

    And it is recognized as a TextMeshProUGUI object:
    upload_2021-5-26_19-43-6.png
     
  6. oni_z

    oni_z

    Joined:
    Nov 25, 2020
    Posts:
    1
    Bumping this up as i have the same issue. Color field does not show up when I use event trigger