Search Unity

SetText on TextMeshProUGUI - Text Scrambles it.

Discussion in 'UGUI & TextMesh Pro' started by Sehlor, Jan 31, 2019.

  1. Sehlor

    Sehlor

    Joined:
    Feb 10, 2012
    Posts:
    199
    Hello,

    I am using TextMeshPro 1.3.0 and Unity 2018.3.3f1 when i tried to set TextMeshProUGUI.SetText with a long string, i get this behaviour:

    https://prnt.sc/meuvpe

    But when i try to write something multilined it draws without a problem.

    https://prnt.sc/meuw4b

    Does this behaviour a bug?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The likely culprit of this behavior are char(13) Carriage Return contained in the text that you copy / paste in.

    This would result in the caret / pen drawing position being returned to the start of the line and characters following the Carriage Return potentially drawn over each other.

    This is the correct behavior for carriage return which is a control character. Most of the time, a Carriage Return is followed by a LineFeed char(10) which is another control character to move down a line.