Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Applying different materials to each word/characters.

Discussion in 'UGUI & TextMesh Pro' started by x4637x, Aug 27, 2020.

  1. x4637x

    x4637x

    Joined:
    May 9, 2017
    Posts:
    4
    I have been searching for a solution to render text like this : upload_2020-8-27_14-24-54.png

    In one sentence, two or more words with different material preset that can be modified on runtime via script.
    Any idea how?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    When using TMP, you can use the <font> tag as follows:

    <font="Name of font asset" material="Name of material preset">

    This allows you to change the reference to the font asset as needed in the text.