I want to import emojis from here: https://github.com/iamcal/emoji-data https://raw.githubusercontent.com/iamcal/emoji-data/master/sheet_emojione_64.png https://github.com/iamcal/emoji-data/blob/master/emoji_pretty.json I see that there's a small emoji one sheet that comes with tmp but it only has like 16 or so... Is there any way to convert the json data into the right format to use with text mesh pro?
See the following post on the TMP user forum. Note that I also added the ability to assign a fallback sprite asset which makes it possible to split those sprites into more than one sprite asset / sprite atlas texture. This became required as fitting over 1500 sprites into a single sprite asset was getting more challenging.
Hmm, sorry, I can't find "texture packer" in unity. Or do you mean this third party tool? Somehow the forum post you linked to is somewhat confusing for me. Do we always start with all individual images and then generate our atlas on our own somehow? (Unity, or some tool?) Could you explain the steps needed to go from the source (either all those individual images, or alternatively the pre-made atlas from emoji one + the json file that describes the mapping) to being able to write <sprite ...> ? Also where and how do I assign that fallback sprite? Would I just give different packing tags in unity? I built my own atlas with the unity sprite packer but I don't see how I can select the atlas in the SpriteImporter, it doesn't appear in the list. edit: I figured out where to assign fallback sprite assets. But how to create a sprite asset from a folder of files is still not clear to me edit2: using texture packer I was able to make working texture sheets and import them with the text mesh sprite importer. The last thing I'm now missing is how to actually draw the emoji. I know that I have to replace the text where I want an emoji with <sprite=...>. But I don't have the sprite ID, just the UTF32 code. edit3: I made a script to get the sprite ID, but even if I have it, how would I write the correct ID so TMP knows which sprite asset to select? All the sprite IDs start at 0, so "Id 0" exists in 8 different sprite-sheets... Another problem is the pivot, the emoji are all offset (-32, +32) edit4: got the offset fixed by using the "global offset" thing Alright, this video cleared up almost everything. Only things remaining are: - Is there a (good) way to create a sprite sheet from multiple files without using TexturePacker? - Is there a way to import the json from the emoji one github? (I guess writing my own converter should be super easy as long as all information is there, but I don't want to work on something that may not even be necessary) bug report: <sprite name="..."> doesn't work when the name is in a fallback sprite asset, my fallback sprite asset list is set populated correctly.
Hmm, it seems like there's nothing I can do: The sprite assets are setup correctly.. @Stephan-B Any idea what the issue could be?
This is in fact an oversight on my part Basically, the fallback doesn't work with the name or index attribute of the sprite tag. Although I don't think it makes sense to have the index be used to search through fallback sprite assets, it most certainly makes sense on the name part which I will be looking into. In the meantime, please note the following: The unicode value does work with the fallback sprite assets. So assuming you assigned the unicode value of "1f3c4" to a sprite in the primary sprite asset and something like "1f42e" to a sprite in one of the fallback sprite assets, typing the following would pull up the sprites. "Sprite 1: \U0001f3c4 Sprite 2: \U0001f42e" BTW: <sprite name="some name"> refers to the sprite with the name "some name" located in the default sprite asset defined in the TMP Settings file. <sprite name="some other name"> would still result in searching through the same sprite asset and not the fallback.
Awesome, that actually did the trick! In the video you didn't mention that you have to use the unicode codes. I thought the only way was to "address" the sprite by name or ID. But there is one other issue that I think is caused by the sprite importer. Its best illustrated by an example: Lets say I want to display the emoji: 1f3c4-1f3fb (Surfing man, white skin color) Then isn't the unicode entry wrong!? (while the name is correct) The unicode thats written there is ambiguous, but the name is correct. How would I display the emojis that use those surrogate pairs? When I just write \U0001f3fb it doesn't work right: The source data from texture-packer contains the correct code, and the sprite asset also gets the correct name assigned, but the unicode seems to be missing the "left" side. edit: I mean I can write \U0001f3c4 and then I get the surfer with white color, but how do I write different skin colors? For example "U+1F3C4 U+1F3FF" (surfing man, skin tone: dark) Another example: U+0023 U+FE0F U+20E3 None of those alone works, and I can't figure out how to combine them into one single unicode entry Copy pasting directly from a website doesn't work either: Code (CSharp):
Emoji modifiers as well as sequences which is what you are describing here is not supported yet. It is on the list of features I am planning on adding.
@dadude123 - Do you have a link where I can find all the latest emoji? Do you think there is a copyright involved with the images mentioned in your first link?
If you already have an atlas that contains all the emoji, then you can always just manually insert sprite tags into the text. Using the json file that texture packer applications generate, it should be trivial to do a .Replace(...) on all text that simply replaces the corresponding symbols with the right sprite tag.
@dadude123 - I am not doing it manually. I am using it for chat application so I believe emoji correspoding to unicode would be shown
Problem is when you tap on the surrogate pair they don't show the right emoji although I have them in the sprites. The problem is not limited to surrogate pairs but with some normal emoji i.e U+2639 (Maybe we're not supporting 4digit Unicode).
I don't fully understand the issue you are reporting in the sense that TextMesh Pro does support both UTF16 and UTF32 which means whether the character, emoji or sprite is mapped to a UTF16 (4 digit as you call it) or UTF32 (8 digit to stick with your descirption) TMP can access them. Can you provide more details or perhaps a simple Repro project for me to look at so I can understand clearly what issue you are having?
Just wanted to add another voice to the thought that sprite name support for fallback assets would be a lovely feature. I ran into this issue as I had assumed this is how it would work. Eventually found out that I could use Unicode. I'm a bit new to sprite assets so I don't really understand how the Unicodes work. I initially manually just put 7 in as a unicode and then attempted \U0007 but this didn't work, upon entering your example 1f42e and typing \U0001f42e I was able to get my fall back sprite to appear. But with 20 sprites in my sheet it feels odd entering random unicode values to get this fallback functionality working. I appreciate this confusion is down to my complete lack of understanding of Unicode.
Unrelated to the above, I create a Sprite Asset from a .psd sprite sheet. I then went back to the .psd and added some more sprites and spliced them up. However when I look back at my Sprite Asset, these new sprites are showing in the Sprite List. Do I need to do anything to update that list? I'm hoping I don't need to create a new Sprite Asset as I've already attached this one as a property on several game objects.
Emojis on Desktop and Mobile devices actually have Unicode values assigned to each of them. See the list here. The reason why /U0007 didn't work is because /u (lowercase) is for UTF16 and /U (uppercase) is for UTF32.
When you update the texture, you will need to again use the Unity Sprite Editor to define those new sprites and then re-generate the Sprite Asset. See the following post. In terms of regeneration of the Sprite Asset, this is something that I'll look at simplifying / improving when I have time.
@Stephan_B any news regarding supporting Sprite Asset fallbacks via sprite name? I'm also trying to use multiple Sprite Assets for emojis and assigning fallbacks as needed at runtime. Currently referencing any sprite in the fallback assets by name isn't working. Also I can't switch to using the Unicode values because I am supporting all emoji modifiers and it doesn't look like TMP supports that yet.
@Stephan_B yes since our goal is to be able to handle any emoji character that the user can type on their device. We had this supported before by using sprite name with just one very large sprite atlas, but we are looking to reduce the memory overhead of that by splitting up the emojis into multiple atlases.
I'll provide a more definitive update tomorrow but I should be able to get this functionality in the next release of TMP which will first be available for Unity 2018.1 via the package manager and then subsequent releases for 2017.1, 2017.2 and 2017.3.
Any update on that topic? Currently working in 2017.4 and i do not have any way to handle Emoji modifiers / sequences.
No updates. This features is part of the larger planned support for OpenType Font Features. Do you need full support for modifiers or just a way to reference those sprites / emoji?
Slowly getting there. First of the new major features will be in the next release of the TMP UPM package for Unity 2018.3 which should be available in the next 30 days or so. New features use a new low level API that is currently only available in Unity 2018.3. Once released for Unity 2018.3, I am hoping to back-port to Unity 2018.1 and 2018.2 and maybe 2017.4 (no promises but would like these new features to be more widely available). Improved Emoji support is not part of this next release. However, once this new low level API and new major feature is available, subsequent new features should come more quickly and in subsequent package updates.
Check my thread, i developed extension to textmeshpro to solve this problem (and to parse jsons from emoji-data and convert it to TexturePacker format that is used in Sprite Imported window to generate SpriteAsset) https://forum.unity.com/threads/full-emoji-support-api-emoji-sequen.660310/#post-4420162
Hey @Stephan_B , could we get a status update on emoji modifiers? I'd really like to have full emoji support in my game.
I am planning on adding support for Emoji modifiers / Ligatures in this current TMP package preview cycle. Ie. in one of the previews of version 1.6.0 for Unity 2018.4, 2.2.0 for Unity 2019.4 and 3.2.0 for Unity 2020.x or newer.
Support for Ligatures will be in the next preview release. I will try to also have support for Emoji modifiers as well.
Hello @Stephan_B, I think Emojis did not get it to the last release 3.2.0-pre2, any ETA for that please?
Hi, I have created a sprite atlas via TexturePacker and imported it inside unity and created sprite asset via Sprite Importer tool of TMP. But the sprite asset created in result don't have correct values for Unicode, though sprite names are set as respective hex values. Am I missing something or do I have to set all those (almost 1000 images) unicode values manually? Thanks