Search Unity

TextMesh Pro Line Break, From NotePad, Generates Symbol Issue

Discussion in 'UGUI & TextMesh Pro' started by renman3000, Oct 24, 2017.

  1. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,699
    Hi there,
    I am trying to use a variable as a string, that I alter via the inspector to adjust the text of a TMP unit.

    The issue is line breaks, I understand that \n is not to be used in preset variables, outside of code and that I should copy and paste into the variable slot, via a NotePad program.

    This works in creating the line break, however, I am getting not only the break as it should be, but a symbol, a square where the new line starts.

    I am not sure if I failed to create a break in the font asset or something.

    Any help?

    Thank you
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Depending on the external tool you are using and operating system, copy / paste can also insert a carriage return \r in addition to \n. So you have to account for that in what script you might be using to set the text.

    You also have to be mindful that Public fields in Unity will double escape characters like \n or \r when typed in the Inspector.
     
  3. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,699


    Ok thanks.
    My solution was to simply set the blinding box of the text accurately and let TMPro just set the breaks itself. Seems
    To work fine.


    That said, is there a perfect external notepad that submits clean breaks to the inspector?