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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

TextMesh Pro Text overlaps itself [SOLVED]

Discussion in 'UGUI & TextMesh Pro' started by keenanwoodall, Jun 5, 2018.

  1. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    595
    upload_2018-6-5_16-10-2.png
    I created a standard Text component and pasted whats in the tmp component and it worked fine. Not sure whats going on. I have a script that's typing out the text, not sure why that would matter though, it's just adding a the next character every few frames.
     
    sonnyb likes this.
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Most likely your text was copy / paste where you ended up with a Carriage Return char(13) in the text. Check the end of the line of text and you should notice the cursor hitting an invisible character. You can also check the string for this char (13).
     
  3. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    595
    Thanks, that was the problem.
     
    Stephan_B likes this.
  4. domdev

    domdev

    Joined:
    Feb 2, 2015
    Posts:
    375
    hello I know its 2020, but I want to know how i can string replace it? just to avoid it in run time
     
  5. AndreInfante

    AndreInfante

    Joined:
    Oct 26, 2013
    Posts:
    5
    @domdev

    pretty late, but if you or anyone else wants to know, it's
    val = val.Replace("\r", "");
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Always be mindful of that Sneaky Carriage Return <CR> in the text ;)
     
  7. baubau

    baubau

    Joined:
    Feb 22, 2017
    Posts:
    2
    Another solution would be to just paste it in Notepad first and correct the Carriage Return there. :) Had the same issue after copy/paste some text from Illustrator.
     
    emazedev likes this.