Search Unity

TextMesh Pro Why does my sprite tag print literally?

Discussion in 'UGUI & TextMesh Pro' started by AcademyOfFetishes, Feb 9, 2019.

  1. AcademyOfFetishes

    AcademyOfFetishes

    Joined:
    Nov 16, 2018
    Posts:
    219
    I'm reading about how to use sprites in textmesh pro. I've read this documentation: http://digitalnativestudios.com/textmeshpro/docs/sprites/ & http://digitalnativestudios.com/textmeshpro/docs/rich-text/#sprite

    I set text to this:
    Cost $3 and 1 <sprite name="Catnip">


    But it looks like this:


    I'm not sure what I've done wrong.

    Here's my sprite atlas:


    And it's placed here:



    I use one prefab for all the text in the game, and its inspector looks like this:



    I feel like there might be some place where I'm supposed to tell the text which sprite atlas to use, but I haven't found a setting like that. Well, I found one in Debug Settings, but that only let me select sprites, not an atlas, and it messed everything up when I picked it.

    Can anyone tell me what I did wrong? I tried my best to follow the directions as closely as I could.

    Update: I tried setting the text to
    Cost $3 and 1 <sprite="skillpoints" name="Catnip">
    , but it still didn't render the sprite.
     
    Last edited: Feb 9, 2019
  2. AcademyOfFetishes

    AcademyOfFetishes

    Joined:
    Nov 16, 2018
    Posts:
    219
    anuragaofl likes this.
  3. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    360
    I've just followed those instructions in 2021 and they still work with TMP 3.0.3
     
  4. anuragaofl

    anuragaofl

    Joined:
    Jun 9, 2016
    Posts:
    6
    This helped us as well (Unity 2022.3.0, latest TMP package). While the documentation at https://docs.unity3d.com/Packages/com.unity.textmeshpro@3.2/manual/Sprites.html (or any other version's documentation available at the time of writing) mentions using `Resources/Sprites` for the default sprite locations for rich-text tags (and was what we had in our project originally), `Resources/Sprite Assets` is the path that fixed it for us. It's either an undocumented change or a bug, but resolves the issue.