Unity Input Field With IME, Arabic, Emoji and Mobile Keyboards
Last reviewed
Unity's input fields struggle with exactly the text players type most: IME composition for Chinese, Japanese and Korean, right-to-left languages, emoji sequences, mobile keyboards and WebGL.
UniText's editable text and input field receive keys, text and IME composition from the operating system directly, independent of the Input System setting, and edit the same shaped text the engine renders: Arabic stays joined while typing, the caret follows bidirectional text, and an emoji family is deleted with one backspace.
The usual options
- TextMesh Pro input field. It edits TextMesh Pro text, so typed Arabic has no shaping or bidirectional ordering. Unity's IME support does not cover iOS, Android or the web, and a report of IME not working in mobile and WebGL builds was closed as Won't Fix. Fixes land per release: a field that cleared itself on a Japanese IME suggestion was fixed in 6000.0.51, and characters with variation selectors that needed two backspaces were fixed in 6.3 and 6.6.
- Mobile keyboards. Hide Mobile Input works only on iOS and Android, and on Android the native field cannot be hidden reliably and hiding it forces the default keyboard type. On the web it has no effect.
- UI Toolkit TextField. With the Advanced Text Generator it shapes right-to-left text, but the caret moves in logical order only.
- Replacement packages. Open-source projects cover parts of the problem: UMI places native mobile fields over the canvas, WebGLInput adds IME and copy and paste to WebGL, and RTLTMPro includes a right-to-left input field.
Editing in UniText
- Native input. On Windows, macOS, iOS, Android and WebGL, keys, text, composition, selection and keyboard visibility come from the operating system, so editing works with Legacy input, the Input System or both.
- IME. Composition is first-class: clauses are styled while they are composed, and input filters never see unfinished composition text.
- Every script. Typing in Arabic, Hebrew, Hindi or Thai is shaped live, and caret movement, selection and deletion work on grapheme clusters with bidirectional caret affinity.
- Mobile keyboards. Keyboard type, return key, autocapitalization, autocorrection, spell checking and autofill hints are set once and mapped to iOS, Android and the web. The return key arrives as Submit, Next, Previous or Newline.
- WebGL. An active field keeps keyboard focus in a page input element, so the browser's IME and on-screen keyboards reach it in WebGL builds.
- Rich editing. Undo and redo, word and paragraph selection, a context menu, touch handles, formatted copy and paste, validators and filters, and a caret that can be restyled.
editable.InsertText("abc");
editable.DeletePrevious();
editable.Copy(); editable.Paste();
editable.Undo(); editable.Redo();
editable.SelectAll();Editing is part of UniText Folio, the current licensed version. On WebGL, while a field is being edited, Unity's input system receives no key events, so handle the field's Submitted, Cancelled and Defocused events instead of polling the keyboard.
Questions
Does it work with the new Input System?
Can I build a chat box or a code editor with it?
RectMask2D.Check it in your project
Run the browser demo, follow the setup guide, or compare the free version with the licenses.
Related problems
- Arabic Text in Unity: Fix Disconnected and Reversed LettersTextMesh Pro has no Arabic shaping or bidirectional ordering, so letters render isolated and reversed. UniText shapes Arabic, Persian and Urdu with HarfBuzz and runs the Unicode Bidirectional Algorithm.
- Clickable Links in Unity Text: Hover, Click and URLsTextMesh Pro marks links but leaves hit-testing and styling to your code. UniText makes link tags, Markdown links and bare URLs clickable with hover states and events on canvas and world-space text.
- Color Emoji in Unity: Flags, Skin Tones and ZWJ SequencesTextMesh Pro has no shaping engine, so emoji families, flags and skin tones often fall apart. UniText renders system color emoji with no setup and forms every Unicode emoji sequence as one glyph.
