Mutli-language support to enter UI.Text field from an iOS Keyboard

Hello,

Scenario

An iOS app where a user types in a content that would be entered into unity ui system. My understanding is that in Unity’s user interface system, in order enter text one has to use UnityEngine.UI.Text

Multiple Questions

  • When the user types in a character, one does not really know what language that keyboard has?
  • Do we have to change the font to adapt to that particular language?
  • Do have to constraint to only a set of languages?
  • Is there another approach beyond UnityEngine.UI.Text?

Conclusion

Thank you for your time. Much appreciate it.

  • Not so easily, I guess it would be possible to write a plugin to find out about this. Not sure though and it needs to be implemented on every platform you support. To detect switching the keyboard language-layout would be almost impossible, though.

  • It depends. When you use the UGUI Text you can assign a dynamic font. such a font automatically adds characters during runtime if there is a not yet used one. So, if the user inserts a chinese symbol that symbol would be put into the dynamic font texture (if it exists in the used font). However, especially for languages with a lot of symbols (like chinese / japanese) the generated font texture might be too small at a certain point. not sure what would happen then.

  • You probably cannot constrain what the user types into the system-keyboard, but you can validate the input and remove all non-supported characters. For UGUI Input Field you can do that validation at the “onValueChanged” event.

  • There is another approach: TextMesh Pro. It is free to download (you can find it in the package manager of recent Unity versions). Pro: The characters look much better and you have a lot of advanced options. Con: It doesn’t support dynamic fonts. so point 2. is not possible here.

Thank you for your reply, Hosnkobf.