Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

TextMesh Pro New <gradient> Rich Text Tag

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

  1. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    1,617
    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,715
    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

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    1,617
    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:
    3,945
    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:
    3,945
    Solved this just using a material with a square gradient made in photoshop.
     
  7. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    1,617
    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.