Virtual keyboard with Chinese Input Method Editor(IME)


The package contains a virtual keyboard that supports English, Chinese, numbers, and special characters input. For Chinese input, it supports the Pinyin input method.


by Mingchong LI


Price History +

Main Usage

  • Chinese fonts are needed. My recommendation is Noto, which is free.
  • Text Mesh Pro is compulsory.
  • [Optional] If you want to generate a new Chinese dictionary:
    • A Chinese word list under the Python directory, named wordfreq.txt, formatted as [Chinese word]t[frequency].
    • pip install pinyin and run cn_parser.py.
    • Open Unity Editor, click Tools > Construct Py Prefab to open the generator, input the Chinese word list and hash txt path, and click generate to get the prefab.
      • For example, if the list you generated is AssetsWPinyinDictionaryPinyinWords-words.json, then input AssetsWPinyinDictionaryPinyinWords.
      • You can also select how many words you need in the list. The words will be selected based on frequency, with high-frequency words having higher priorities.
    • Open the KeyBoard prefab, drag the word prefab you just generated onto the pyCode field.
  • [Optional] If you want to generate a new English word dictionary:
    • An English word list under the Python directory, named en_freq.txt, with a title in the first line, formatted as [Word]t[PoS]t[Freq].
    • Run en_parser.py.

Code Usage

  • To set the target input field: KeyBoardManager.SetTargetField(TMP_InputField target).
  • To refresh and add input field focus listener: KeyBoardManager.GetAllInputFields().

Meta data

  • Author: Mingchong Li (email me)
  • Date: 10/8/2024
  • Version: 0.3