Search Unity

TextMesh Pro New <gradient> Rich Text Tag

Discussion in 'UGUI & TextMesh Pro' started by Stephan_B, Nov 29, 2017.

  1. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Added a new rich text tag <gradient> </gradient> which makes it possible to assign a Color Gradient Preset on the text enclosed between those two tags.

    The format for the tag is as follow: <gradient="Name of Color Gradient Preset">Some text</gradient>

    Since these Color Gradient Presets will need to be loaded at runtime and similar to other TMP assets, these have to be located within a Resources folder. The specific location within Resources folders can be defined in the TMP Settings file.

    Here is an example using this new tag.



    Raw input text
    upload_2017-11-28_17-14-46.png

    Please note <gradient> tags can also be nested like many other tags in TMP.

    This new feature will be in the next release of TMP which should be available later tonight. You will find direct links to download these new releases in the top sticky post in the Unity UI & TextMesh Pro section of the user forum. These releases will also be available thru the asset store within the next few days. As usual be sure to read the Release and Upgrade notes and to always back up your project before upgrading to new releases.
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Always cool to see nice updates & improvements to this cool asset / part of Unity ;)
     
  3. Lukasland

    Lukasland

    Joined:
    Feb 1, 2018
    Posts:
    1
    Possible to get this to work with sprites?
    Thank you!
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I just made the change where the <gradient> tag will also color the sprites provided the tint attribute is set to 1 as per the example below.

    A <gradient="Yellow to Orange - Vertical"><sprite="DropCap Numbers" index=0 tint=1> <sprite="DropCap Numbers" index=0 tint=0></gradient> B

    upload_2018-3-16_13-30-43.png

    This change will be in the next release of the TMP UPM package for Unity 2018.1.
     
    Last edited: Mar 16, 2018
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    I was just playing with the gradient setting.
    It seems to be a per letter gradient, but is there a way to get it to be a gradient over the entire word? So that it goes from left to right and changes colors. Also, I noticed the gradient doesn't seem to affect the underline, which is still white. Is there a way to apply that to the underline?
     
    NeatWolf likes this.
  6. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    Solved this just using a material with a square gradient made in photoshop.
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Feature request noted in regards to both having the gradient tag apply to the characters enclosed in the tag and better handling for the underline.
     
  8. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
  9. unity_DCE7292CAECD1B188012

    unity_DCE7292CAECD1B188012

    Joined:
    Jul 1, 2022
    Posts:
    1
    KING THANKS
    you saved my time...