- Extends from UnityEngine.UI.Text
- Has the same performance if no EmojiConfig attached.
- Layout handled by UnityEngine.UI.Text, only replaces UVs of generated text mesh. Thus you can use RichText to change size and color of text. (Emoji sprite wont change color. I disabled it. And you also need to set sizeFactor in EmojiConfig to 1)
- No sub GameObject needed (actually need one for attaching CanvasRenderer). Use CanvasRenderer to render emoji mesh.
- Support hyperlink click event with markdown link syntax.
- Support pre-defined text by markdown predefined text syntax. `predefined text`. And predefined text replacements delegates to
- Support escape character by input \uxxxxx directly.
- Generate your own EmojiConfig with different emojis by using AltasBaker in Emoji -> Atlas Baker (you can use altas baker for other stuff, it reports all UVs and names to AtlasBakerWizard.OnAtlasBaked)
- Works in edit mode.
- Copy Unity3D.EmojiText to your own Assets folder
- Create GameObject under Canvas
- Attach EmojiText component to the GameObject just created
- Drag and drop asset
Unity3D.EmojiText/EmojiConfigto Config field
- Now you have emoji text with all TwitterEmoji characters.
- If you want to handle hyperlink (markdown syntax), just add some Href On Clicked Event
scn_demofor more details.
- Unity3D 5.3.x has bugs in InputField with emoji charaters, plz check
EmojiTouchScreenInputField.csfor details (i just copy from UnityEngine.UI and did some fix).
Create your own emoji characters
- Create folder in your project. (like
- Copy your emoji sprites to this folder. The name of sprite should be the unicode of character. If you want to replace
Awith emoji sprite, just put a
41.pngto MyEmoji folder
- Add EmojiText component to a GameObject without assigning EmojiConfig, you can see
Create Configbutton in Inspector
Create Configbutton, you will get a EmojiConfig.asset in Assets folder
- Select EmojiConfig.asset. You can see
Create Atlasand in the Atlas tool box, put path to
Asset/MyEmojiin path to texture field, and then press
- Now you will atlas texture and correct emoji config with character
- If you want to add more emoji character to exist config, you can add multiple paths in atlas step
Idea and some part of code come from Unity-UI-emoji, I changed it to fit my implementation.