Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unknown line break

Discussion in 'UGUI & TextMesh Pro' started by Shadowing, Apr 8, 2021.

  1. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    In my chat I have a string like this below and it adds a break between the p and the y

    it wont let me post the string says they are banned Russian characters.
    There is no /n between the p and y though. When I look at the string in the inspector on the TextMeshProUGUI component

    upload_2021-4-8_16-6-49.png
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you copy / paste the text into a .txt file and then post that file.

    I suspect some control character. You should be able to determine that by iterating over the string and checking each char.

    P.S. I have spoken to the forum folks about this banned character thing which is related to trying to limit forum spam but clearly an annoyance for text users.
     
  3. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I am not seeing any special characters between the "p" and "y" in the text you provided me.

    If you use the arrow keys to step over the text in the Text Input Box, does the cursor seem to get stuck between the "p" and "y" on your end? If so, that means there is a control character there.

    This is the result I got by copy / pasting this text in a text object using the default LiberationSans SDF font asset.

    upload_2021-4-9_0-41-31.png

    The square characters after the y indicate missing characters and glyphs from your font asset. This either means, these characters are not present in the font file or could not be added to the font asset's atlas texture because perhaps it is full and no fallback is available.
     
  5. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    Ya you gave me some links on the square issue. I just haven't gotten to it yet.
    I step through it with the arrows keys and there is no invisible step.

    Here is a screen shot below. Also I noticed it creates this child game object on non English languages.

     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Sub text objects are created as needed whenever a character comes from a fallback font asset, sprite asset or other atlas texture when using Multi Atlas texture on the font asset.

    What version of the TMP package are you using?

    Check the LiberationSans SDF - Fallback in your project. Is its atlas texture full? If it is, you can either increase the Atlas size in the Generation Settings to 1024 x 1024 or enable multi atlas texture on this fallback font asset.
     
  7. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    I don't have any in my Fallback Font Assets. Says List is Empty.
    Probably a stupid question but...
    What should i put there lol? LiberationSans SDF - Fallback ?

    Unity 2020
    Version 3.0.4 - February 19, 2021
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The default LiberationSans SDF included in the TMP Essential Resources already points to LiberationSans SDF - Fallback in its local fallback list as seen below.

    upload_2021-4-9_1-34-49.png
     
  9. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    ahh ok i was looking at TextMeshPRo settings. I'm looking at what you are looking at now on your screen shot.
    how do I tell if the atlas is full?
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Simply select the Atlas Texture of the font asset in the Project Window as seen below.

    upload_2021-4-9_14-17-56.png

    As you can see in the above image, the atlas texture of my LiberationSans SDF - Fallback font asset only contains a few characters.

    Note: You can Reset any font asset and their atlas textures by using the Context Menu Reset option on the font asset. Note that it will clear the whole font asset dynamic data so make sure you don't accidently Reset a static font asset for instance.

    Note2: If the atlas texture of your fallback is full, you should consider enabling "Multi Atlas Texture" on that font asset or consider increasing the atlas texture size.

    I would recommend watching the following two videos which cover all of this information.