Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug TMPro Bug: <nobr> does nothing in v3.0.3 (Unity 2020.1.9)

Discussion in 'UGUI & TextMesh Pro' started by dpt2, Jun 15, 2021.

  1. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    What happens now: `<nobr>This is not supposed to break</nobr>` will break lines.

    What should happen: `<nobr>This is not supposed to break</nobr>` should not break lines.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The <nobr> tag prevents normal line breaking of the text enclosed in the tag. However, if the width of the text container is smaller than the text enclosed in the tag, the text will break is usual.

    Here is an example using version 3.0.6 with the following text: "AB <#ffff80><nobr>CD EF</nobr></color> GH"

    upload_2021-6-15_14-37-44.png

    In the above image, the text fits on a single line so no break.

    upload_2021-6-15_14-38-42.png

    Line breaks on the space after "EF" resulting in "GH" moving to 2nd line.

    upload_2021-6-15_14-39-58.png

    Although "CD" could still fit on the first line, the block of text enclosed in <nobr> wraps to second line.

    upload_2021-6-15_14-40-58.png

    Since the width of the text container is smaller than the block of text enclosed in <nobr> we get normal line breaking.

    This is how the <nobr> tag is expected to work. Perhaps you expected a different behavior and if so what was it?
     
  3. dpt2

    dpt2

    Joined:
    Jun 15, 2021
    Posts:
    50
    I get that for static size: However, with auto size on (with a minimum low enough to fit on the same line), the expected behavior was to shrink instead of break.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you post the setting that you have on that text object so I can try to reproduce the behavior?