Search Unity

TextMesh Pro Rendering text over inline sprites

Discussion in 'UGUI & TextMesh Pro' started by R4vakk, Mar 4, 2020.

  1. R4vakk

    R4vakk

    Joined:
    Oct 10, 2015
    Posts:
    17
    Hi,

    Is it possible to render text on top of inline sprites?
    Entering this snippet in TextMeshProUGUI
    <sprite=0><space=-20>i
    will hide the character behind the sprite, but I want the opposite to happen.

    Changing the Render Queue achieves the desired result in the Scene View, but not in the Game View.
     

    Attached Files:

  2. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    By default, the earlier characters in your TextMesh text will render behind the later characters. You can reverse that so the earlier characters render in front of the later characters by using the "Extra Settings" dropdown at the bottom of the TextMesh component and set "Geometry Sorting" to "Reverse".

    You could probably also solve this by reversing the order in the text instead of reversing the sort order:
    i<space=-20><sprite=0>
     
  3. R4vakk

    R4vakk

    Joined:
    Oct 10, 2015
    Posts:
    17
    Thanks for your answer,

    I didn't think to mention it, but I also tried to change the Geometry Sorting, without success (either in Scene or Editor View).
    Reversing the text also doesn't work (in the latest release of TMP, and Unity 2019.3.3f1).

    This seems to be specifically a problem for inline sprites, rendering order for characters works fine.
     
    Last edited: Mar 5, 2020
  4. XRom_Games

    XRom_Games

    Joined:
    Oct 3, 2018
    Posts:
    1
    Hi. That's because TMP SubMeshUI [TextMeshPro/Sprite] generates as a child of TMP_Text in hierarchy. I drag it before and it works for me. May be that will help you.
     
    Last edited: May 12, 2020
    Zarokima likes this.