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. Dismiss Notice

Bug Getting text from TextMeshProUGUI.text creates additional escape character

Discussion in 'UGUI & TextMesh Pro' started by Stewcooker, May 1, 2023.

  1. Stewcooker


    Mar 11, 2018
    So I am using the editor editor to fill in a few TMP text boxes, and the text I am using makes frequent use of the emdash character, U+2014. In the editor text box, I am inserting "\u2014" to add the emdash to my text.

    However, later I am getting text from these text boxes via TextMeshProUGUI.text. When this happens, my "\u2014" gets escaped, and my string now looks like "\\u2014", causing displaying this string elsewhere to show "\u2014" instead of an emdash.

    Is this problem caused by entering the text in the unity editor, or is there something I am doing incorrectly? How can I avoid this issue without writing a parser or something like that?