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

TextMesh Pro Full Emoji Support Api (emoji Sequen

Discussion in 'UGUI & TextMesh Pro' started by Rafael_CS, Apr 12, 2019.

  1. Yeisonlop10

    Yeisonlop10

    Joined:
    Jan 10, 2018
    Posts:
    19
    Hi @Rafael_CS . Just followed the steps. Still the same :(
     
  2. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Try import to a Fresh Project to understand what you are doing wrong. Probably is related to your font.
     
  3. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    VERSION 1.0.3 is Alive!!

    We finally fixed the sprite importer tool (as TextMeshPro Sprite Importer was not working since version 1.4)

    now we have our onw Sprite Importer Tool with support to EmojiData Json and TexturePackerJson

    upload_2020-2-4_17-36-44.png

    This new tool generate a variation of Sprite_Asset that can use a different texture per platform.
    I added to the project a version os EmojiData with support to emojis of Google and Apple in same asset.

    upload_2020-2-4_17-39-9.png
     
    Last edited: Feb 4, 2020
  4. Yeisonlop10

    Yeisonlop10

    Joined:
    Jan 10, 2018
    Posts:
    19
    Hi Rafael. this is from a new scene with the default font
    upload_2020-2-4_16-1-19.png
     

    Attached Files:

  5. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Fresh Project... not a fresh scene.
     
  6. Yeisonlop10

    Yeisonlop10

    Joined:
    Jan 10, 2018
    Posts:
    19
    Hi @Rafael_CS . I have opened it on a new project and I have found that it works when I add the text mesh pro component on a canvas element, but in my case /I want to add it on multiple cubes. Is there any possibility to make it work there? thank you for your help.
    on canvas:
    upload_2020-2-5_14-57-9.png

    on a cube:

    upload_2020-2-5_14-58-0.png
     
  7. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    EmojiTextComponent is an extension of TextMeshProUGUI and only works inside a canvas.

    You can configure canvas to wordspace. Just study "Canvas WorldSpace" to understand how to place UI elements in 3D space
     
    Last edited: Feb 5, 2020
  8. Yeisonlop10

    Yeisonlop10

    Joined:
    Jan 10, 2018
    Posts:
    19
    hi yes, just I also thought about that after I wrote you , I just did that and it worked thank you
     
  9. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    48
    Hi there! In Unity 2019.2.18f1 shows this error:
     
  10. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Fixed in Version 1.0.4
     
  11. byt112000

    byt112000

    Joined:
    Feb 11, 2020
    Posts:
    1
    I'm using the latest version of TextMesh Pro but i am missing the Emoji tool.
     

    Attached Files:

    Last edited: Feb 12, 2020
  12. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Install the last package.... you need my Custom API to use emoji tool
     
  13. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    NEW VERSION ALIVE
    1.0.5

    special thanks to @Jameso3h to report the bug in Emoji Importer Window and Unicode from name
     
  14. Ceciaman

    Ceciaman

    Joined:
    Jul 30, 2013
    Posts:
    52
    Hi,
    when i compile the Build for IOS in Xcode i'recived this error
    It appear when i use emoticon icon on iPhone Device
    How can solve it?

    2020-03-21 13:28:45.127415+0100 uwall[16525:5966227] [User Defaults] Couldn't write values for keys (

    "Dictation SLS Languages Enabled"

    ) in CFPrefsPlistSource<0x282d18800> (Domain: com.apple.assistant.support, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
     
  15. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    This is not related to this emoji API.
     
  16. Virt_Arch

    Virt_Arch

    Joined:
    Oct 19, 2015
    Posts:
    6
    Hi Rafael,

    The package looks great. I've installed version 1.0.5 on Unity 2019.2.3f1 but I'm getting two errors that are preventing me using the Emoji Text UGUI:

    Library\PackageCache\com.kyub.emojisearch@4ccee32d44b9228b12260c686d0ea015ffdb2f61\Runtime\Scripts\SearchApi\TMP_EmojiSearchEngine.cs(151,78): error CS0117: 'TMP_TextUtilities' does not contain a definition for 'StringHexToInt'

    And
    Library\PackageCache\com.kyub.emojisearch@4ccee32d44b9228b12260c686d0ea015ffdb2f61\Runtime\Scripts\SearchApi\TMP_EmojiSearchEngine.cs(179,93): error CS0117: 'TMP_TextUtilities' does not contain a definition for 'StringHexToInt'


    How can I should I resolve those? Many thanks.
     
  17. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Which version of text mesh pro?
    Try upgrade to Version 2.1.0-preview5
     
  18. Virt_Arch

    Virt_Arch

    Joined:
    Oct 19, 2015
    Posts:
    6
    Thanks for responding. I realised I'd made an error setting it up. In order to access and update the text element do I need to add a particular namespace? Also, what's the reference for the text element? The following is giving me a null reference:
    informationPanel.GetComponent<TMP_Text>();
    . Code correction isn't suggesting an alternative component name so I'm not sure what I need to substitute for
    <TMP_Text>
    . Many thanks.
     
  19. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Namespace TMPro, like normal component

    GetComponent<TextMeshProUGUI>
     
  20. Virt_Arch

    Virt_Arch

    Joined:
    Oct 19, 2015
    Posts:
    6
    Thanks Rafael. Really nice package!
    <TMP_Text>
    was fine in the end. The issue was an inspector reference that got broken when adding the new component.
     
    Rafael_CS likes this.
  21. cuppon

    cuppon

    Joined:
    Oct 25, 2019
    Posts:
    1
    Hi , when i use TMP_inputfield to input emoji on mobile phone, What I expected is like \ud83c\udf3d\ufe0f , but in TMP_EmojiTextUGUI i find the text is \ud83c\udf3d ,how can i get the missing part of \ufe0f ?
     
  22. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    \ufe0f is union special character and may or maynot be present when typing with android keyboard.

    because of that i removed this character to correctly find char sequences when \ufe0f was not typed
     
  23. T0YN3TT

    T0YN3TT

    Joined:
    Feb 17, 2020
    Posts:
    4
    Hello Bro, i add your api dependency in the manifest but its not works.. dont download.. i need some third party software such git? or it not necesary? srry for my bad english
     

    Attached Files:

  24. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
  25. T0YN3TT

    T0YN3TT

    Joined:
    Feb 17, 2020
    Posts:
    4
    I have git cli installed.. i've downloaded tortoise too but not works.. I don't know what happens.. i would like to download your api from another site and then import it to unity
     

    Attached Files:

  26. CubeGameStudio

    CubeGameStudio

    Joined:
    Dec 1, 2019
    Posts:
    18
    Great work man! Just start using it on my 2019.3.3 and its working perfectly!
     
  27. DimaHubenkoGamepoint

    DimaHubenkoGamepoint

    Joined:
    May 16, 2018
    Posts:
    20
    Hello, is there any plan to get emoji atlases directly from the system (iOS/Android). I believe your plugins is awesome, but we are not the only who aware of putting giant atlases in mobile builds. Also maintaining all of them on each emoji update is not the best idea.
     
  28. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Well, thats not a trivial task.
    By now i dont have enough time to implement this kind of request but, yes, it was in my plans in a near future.
     
  29. CPUCPU

    CPUCPU

    Joined:
    Nov 15, 2019
    Posts:
    10
    Hey @Rafael_CS - super grateful for this plugin. Thank you!

    I've hit one snag: I've tried to upgrade to 64px emojis but when I generate a new sprite asset, it seems like the sprite character table is setting all the Glyph IDs to zero. Any ideas why? I'm using Unity 2019.3.12f1 and TMP 2.1.0 preview.12 (I've also tried multiple other preview versions and still didnt work).

    upload_2020-5-22_18-27-24.png

    Also, I noticed you said this project is open source, but I can't quite figure out how to find the public repository. Would love to contribute!
     
  30. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    @caseypugh take a look at my comment from past about how to generate 64x64 glyphs.
     
  31. CPUCPU

    CPUCPU

    Joined:
    Nov 15, 2019
    Posts:
    10
    @Rafael_CS Thanks! I actually used that post to get to the point where I am now, but it doesnt describe why all my glyphs are being set to ID=0 (all of them are the hash tag). I ended up fixing/hacking this myself, by opening the emoji.asset file in VS Code and using this handy plugin to auto increment all the IDs from 0 to 3183.

    But obviously, that doesnt solve the underlying issue. Perhaps something to look into?

    BTW, it'd be great if you could publicly open source this on gitlab or github so others can contribute! It's hard to follow along in a forum thread. Thanks again for your work on this.
     
  32. DimaHubenkoGamepoint

    DimaHubenkoGamepoint

    Joined:
    May 16, 2018
    Posts:
    20
    Well, think about making Native atlas work, because even your current solution is "sellable", but if you add this feature - you will be able to set some good price on it.
    Indie developers do not make games with chat, that is a pretty expensive feature. Big companies always have problems with chat nowadays. Catch the wave before Unity have made their own package :D
     
    Rafael_CS likes this.
  33. realragnvaldr

    realragnvaldr

    Joined:
    Jul 21, 2019
    Posts:
    41
    @Rafael_CS Thanks for this absolutely great package!! I have the same question as was asked on the first page of this thread: is it possible to scale the emojis? The resolution is perfectly fine, so i would like to keep the 32x32 sprite to not increase the build size unnecessarily, but it would be nice if the emojis can simply be scaled up a bit.

    Right now, the emojis produced by your package seem to have the same size as the text, which makes them a bit hard to see (unless i make the font larger, which would result in clearer emojis, but unnecessarily large characters). Most app out there seem to deal with this by displaying emojis as larger than the typical letter character. Here's an example: TEXT:) <--- this emoji clearly has a larger height than the text (and would be a bit hard to see if that weren't the case). You see what i mean?
     
  34. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    I will take a look on it

    this is in my TODO list
     
    realragnvaldr likes this.
  35. realragnvaldr

    realragnvaldr

    Joined:
    Jul 21, 2019
    Posts:
    41
    For those of you who have the same scaling question as i had, here is a temporary solution until @Rafael_CS makes this a feature (it is on his TODO list).

    1. Open the Sprite Asset (or whatever it's called) in the Unity Editor, which for me is EmojiData_google_apple:

    upload_2020-5-26_19-25-54.png

    2. Click on Sprite Glyph Table tab
    3. You can change the scaling by filling in a value in the SF field:

    upload_2020-5-26_19-27-29.png

    It will rebuild some stuff as you fill it in so it's a bit slow.

    In my case, the emojis seemed to float a bit "in the air", so i also played around with the Y-offset by changing the OY value. For me, a value of 25 works well.

    So, before scaling up, it looked as follows:

    upload_2020-5-26_19-31-41.png

    After scaling up, to 1.28, i get:

    upload_2020-5-26_19-33-35.png

    I could probably scale up the emoji slightly further. A value of 1.31 gives

    upload_2020-5-26_19-35-31.png
     
    Rafael_CS likes this.
  36. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Thats a good solution.
    Another solution could be related to add <size> tag around the character (i must implement this)

    I think changing this scale value could be better than add tags.

    thanks for this insight
     
  37. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Thanks again @realragnvaldr

    I submitted a new version (1.0.8) with support to this new feature in Sprite Emoji Creator.
    upload_2020-5-26_18-28-14.png

    I already fixed the bug reported by @caseypugh

    thanks everyone for the reports
     
  38. realragnvaldr

    realragnvaldr

    Joined:
    Jul 21, 2019
    Posts:
    41
    Great, thanks for the super quick response to this feature request! :) Before i found the scaling trick, i actually tried exactly what you suggested first, namely to put <size=..> tags around the emojis, in line 73 of TMP_EmojiSearchEngine.cpp:

    Code (CSharp):
    1. sb.Append(string.Format("<size=XX><sprite name=\"{0}\"></size>", v_lookupTableSequences[v_sequence]));
    2.  
    However, that must have been the wrong place, because it didn't work (when i replaced the tags that i added with regular characters, the characters also wouldn't show up). Anyway, this is no longer relevant, because of the other solution.
     
  39. universityofgames

    universityofgames

    Joined:
    Nov 24, 2016
    Posts:
    34
    Hello guys,

    I noticed that when displaying emoji on Apple with different colors, additional trash is added to the text box. For example, in the case of displaying appears + . Is this a library problem or image assets?

    Thanks!
     
  40. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Probably problem with emojidata.json

    Char sequence is a sequence of unicode characters that is translated to an Emoji.

    Probably this emojidata used has missing translations (the asset inside project support emoji data 12.0 and apple is using 13.0)

    You need to upgrade the asset using new Emojidata.json
     
  41. BalconyFalcony

    BalconyFalcony

    Joined:
    Feb 2, 2016
    Posts:
    2
    I've been working on fixing TMP_InputField to support emoji sequences. They are not handled correctly when moving the caret or removing symbols. Although I am not sure if this is a problem with all versions of TMP or just mine.

    The problem was in m_TextComponent.textInfo object, its index and stringLength values for emoji sequences are incorrect. I had to go through the text again and calculate correct indexes and lengths by adding a function to TMP_EmojiSearchEngine that returns the length of a sequence at position.

    I also had to do some fixing inside of the TMP Input Field class to force the caret to move based on m_TextComponent.textInfo data.

    So if anybody still has this issue on some version of TMP, I could post the code.
     
    Yennny and unity_IhzkgerRVepvcw like this.
  42. justin_bling

    justin_bling

    Joined:
    Oct 24, 2019
    Posts:
    3
    Love the package! Any way to get the emoji to "center" so it's inline with the text it's adjacent to starting with the bottom of the emoji? It kinda looks like it's floating.
     
  43. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    I would love to have a fix for TMP_InputField as yes it is not behaving correctly with The emoji stuff.
     
    unity_IhzkgerRVepvcw likes this.
  44. Yeisonlop10

    Yeisonlop10

    Joined:
    Jan 10, 2018
    Posts:
    19
    Hi guys. I would like to define a default Emoji to be presented when the engine doesn't find the emoji we are looking for, this in the case of an update of emojis or new emojis that we don't have in the current tables and sprites. Where is the best place to implement this? For example in the past I saw the ? emoji being rendered. I would like to add something different. So far the sprite assets and fallbacks that I have added are working properly.
     
  45. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    161
    Uou can use TmpSettings of textmeshpro to configure a character to appear when glyph not found in list. The default character is an empty square, but you can change place any character,
     
  46. Yeisonlop10

    Yeisonlop10

    Joined:
    Jan 10, 2018
    Posts:
    19
    Excellent Rafael. But it means that also if there is any text character, say an unsupported foreign language it will also render the emoji. Any form to do this limiting just to emojis?.
     
  47. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    515
    Thanks for your work.
    Unfortunately the emojies images are way too small, almost 2x times.
    Because of this addon use UPM, there is no way to scale them up. Is there any other option?
    screenshot

    UPDATE
    I found that the sprite just fit the available height, because trying to set size for sprite a bit bigger increased line spacing as well - screenshot
    Not expected results.. on a seconds image the emoji size is closer to what we see in native messengers, but I don't see the option how to set proper size without braking line spacing.

    Any ideas?
     
    Last edited: Jun 27, 2020
  48. BalconyFalcony

    BalconyFalcony

    Joined:
    Feb 2, 2016
    Posts:
    2
    This is what I had to do.
    • I've added GetTextInfo() to the default TMP Input and made some changes to the navigation. It's not the most elegant solution, but it seems to be working.
    • I've added GetSymbolLength() to the EmojiSearchEngine so that I am able to quickly parse text info and fix symbol indices and lengths.
     

    Attached Files:

    Rafael_CS likes this.
  49. Aelcyx

    Aelcyx

    Joined:
    Jun 13, 2014
    Posts:
    12
    This is great! I just want to let others know that if you have a missing mono script upon upgrading, don't replace it -- just delete it and put in the new TMP_EmojiTextUGUI script. Otherwise your editor may crash.
     
    Last edited: Aug 8, 2020
  50. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    293
    Hi, the ChatInput.cs have dependency on your private namespace. Could you tell me what the
    EmojiHelper.IsAnEmojiSubchar do?