Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug [TextMesh Pro] Mesh Bounds Appears to be Incorrect

Discussion in 'UGUI & TextMesh Pro' started by NiallSoe, Mar 24, 2023.

  1. NiallSoe

    NiallSoe

    Joined:
    Jan 30, 2018
    Posts:
    17
    hi @Stephan_B ,

    I have noticed that the mesh bounds can be misreported in some circumstances.

    I have been trying to use the Text's reported mesh bounds to assist with layout which led me to double check my results with the in-built info component. Turning on the "Show Mesh Bounds" option in the "TMP_Text Info Debug Tool" component confirms the results I am seeing.

    I would expect the orange box to only continue as far as the right hand side of the final t's quad.

    upload_2023-3-24_14-29-9.png

    If I reduce the Text's RectTransform width, then the mesh bounds begin to display correctly at a certain point:

    upload_2023-3-24_14-31-26.png

    The same problem occurs with the vertical bounds if top or bottom alignment is selected and the Text's RectTransform height is quite large:

    upload_2023-3-24_14-32-30.png

    Setup: Unity 2021.3.17 and TMPro 3.0.6.

    Thanks a lot.
     

    Attached Files:

  2. NiallSoe

    NiallSoe

    Joined:
    Jan 30, 2018
    Posts:
    17
    I've also hit an issue where I've managed to break the geometry based centring using Rich Text Tags...

    <cspace=-0.1em>25</cspace><size=56%><voffset=0.53em><space=0.035em>%</voffset></size><space=-0.5325em><voffset=-0.013em><size=27%><cspace=-0.3em>OFF</cspace></size></voffset>

    upload_2023-3-24_19-31-34.png

    It seems to partially linked to the negative character spacing as when I change the final one to 0, it renders more in the centre of the rect (but still not quite centred).

    <cspace=-0.1em>25</cspace><size=56%><voffset=0.53em><space=0.035em>%</voffset></size><space=-0.5325em><voffset=-0.013em><size=27%><cspace=0em>OFF</cspace></size></voffset>

    upload_2023-3-24_19-33-22.png

    Other types of alignment are also broken with the original string, most noticeably Right alignment:

    upload_2023-3-24_19-38-4.png