Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

TextMesh Pro TextMesh Pro InputField Incorrect Editing Behavior on Emojis

Discussion in 'Unity UI & TextMesh Pro' started by foundway, Nov 8, 2018.

  1. foundway


    May 30, 2013

    I am trying default emoji support with unicode in the out-of-box package (with EmojiOne). What I found is that displaying is perfect, but while I use the provided 16 emojis in TMP_InputField. Something unwanted happened when I try to Backspace or Select and Edit.

    To reproduce:
    1. Import TextMesh Pro
    2. Create a new scene
    3. Create a TextMesh Pro - InputField (TMP_InputField)
    4. Type one of the 16 provided emoji (for test purpose, just copy and paste this character: )
    5. The emoji should display correctly at this point
    6. While Caret is at the end, hit Backspace and it becomes:
      And we got unstopping errors:
      Assertion failed: TLS Allocator ALLOC_TEMP_THREAD, underlying allocator ALLOC_TEMP_THREAD has unfreed allocations, size 71680
    7. The same thing happen if you hit Delete while caret is at the beginning of the input field.
    Seems like Emoji 6.0 uses two characters in Unity's text field but keyboard operation works only one character at a time. So far I haven't able to find any work around. Anyone runs into the same issue?
  2. Stephan_B


    Unity Technologies

    Feb 26, 2017
    This is a known issue and something I need to address.

    Most Emojis are mapped in the UTF32 range and require the use of surrogate pairs. So when you delete / use backspace, you end up deleting half of the surrogate pair which is an invalid character and leads to this issue.
  3. faleoc


    Aug 13, 2018
    Thanks for your prompt response!

    I plan to try two possible workarounds:
    (1) Process TMP_InputField.text at OnValueChanged to remove the left over invalid character. But problem with this method is that the Assertion failure will probably still happen.
    (2) Use <sprite=xxx> fallback in text and process it at OnValueChanged with REGEX to remove unpaired "<" or ">". This method is probably more reliable than former one.

    Any other ideas? I'll post how the workaround works here when I get to it.