Bugs happen when typing Chinese words in Editor and UI

Hello,

I found that Unity Editor and Unity’s build-in UIs are very buggy when it comes to typing Chinese words. I have submitted a bug report to Unity yesterday. There are many users that would be typing Chinese words in Unity and Input Field, but surprisingly I didn’t find any post in the issue tracker that are mentioning these issues. My game is largely based on Chinese words and I need to type Chinese in the Editor, these bugs have caused hindrance to my development. So I spent some time writing bug report and recorded a video, and here is my bug report:

I am using Unity 2018.2.18f1 (now I have upgraded to 2018.3.f02, but the bugs still exist) and I am a Unity Plus user, my operational system is Windows 10.

I am going to report 4 bugs here:

Bug#1

I am using “Microsoft Bopomofo” to type Chinese characters in the input field of Inspector. I found that if I don’t hit Enter to confirm the typing and click somewhere else, the characters that I inputted will be duplicated for unknown reason, there is certainly something wrong with the Unity’s source code. After the bug occurs, we won’t be able to type Chinese until we hit “Ctrl” + “Space”.

Bug#2

The same issue happens when I create a Unity’s build-in Input Field UI, and then I run the game, after typing some Chinese characters in the Input Field using “Microsoft Bopomofo” and not hitting the Enter key, I click somewhere else, the Chinese characters in the Input Field get duplicated.

Bug#3

If I create multiple Unity’s build-in Input Fields and replace the fonts of Input Field, both placeholder and text, with a Chinese font, run the game, type some Chinese characters in the first input field without hitting Enter, and then type some Chinese characters in the second input field without hitting Enter again, Unity will throw an error message and the text of every input field glitches for unknown reason.

Bug#4
Once we reproduce either Bug#1 or Bug#2, we won’t be able to type Chinese in Unity or in the build-in Input Field UI, but we still can type Chinese on other software other than Unity or the game that is built with Unity. We have to hit “Ctrl”+“Space” to be able to type Chinese again.

I have attached a video file named “Bugs Reproducing Demostration.wmv” showing how exactly we can reproduce the bugs.

Here are the instructions to reproduce the bugs:

Bug#1

Step1: create a brand-new Unity project

Step2: create a build-in Text UI

Step3: type some Chinese characters in the input field of the Text component in the inspector without hitting Enter key

Step4: click somewhere else, the Chinese characters in the input field of Inspector will get duplicated

Bug#2

Step1: create a brand-new Unity project

Step2: create a build-in Input Field UI

Step3: run the game

Step4: type some Chinese characters in the Input Field without hitting Enter

Step5: click somewhere else, the Chinese characters in the Input Field will get duplicated

Bug#3

Step1: create a brand-new Unity project

Step2: create three build-in Input Field UIs

Step3: for demonstration sake, download free Chinese font “SourceHanSerifTW-Regular.otf” here (the bug doesn’t depend on the Chinese font the user is using), source-han-serif/SubsetOTF/TW/SourceHanSerifTW-Regular.otf at release · adobe-fonts/source-han-serif · GitHub

Step4: replace the fonts of the Input Fields, both placeholder and text, with the Chinese font we have just downloaded

Step5: run the game

Step6: type some Chinese words in the first Input Field without hitting Enter key

Step7: hit “Ctrl” + “Space” to be able to type Chinese again

Step8: select the second Input Field and type some Chinese words in the second Input Field without hitting Enter key

Step9: click somewhere else, Unity will throw an Invalid Operation Exception error in the console and the texts in the Input Field glitches

Bug#4
Step1: after reproducing Bug#1 or Bug#2, we won’t be able to type Chinese using Microsoft Bopomofo until we hit “Ctrl”+“Space”.

PS. I actually don’t know why we can fix Bug#4 by hitting “Ctrl”+“Space”, I found this method by accident.

Are you having these issues as well?

1 Like

I have also tested the TextMeshPro’s Input Field, it has bug#2 as well, but it seems that it doesn’t have bug#3.

Prior to releasing the next release of the TextMesh Pro package with the new Dynamic SDF system, I wanted to address as many reported issues as possible without incurring too much delays on the release.

As such I am currently going through the list of reported issues with the TMP Input Field and will take a look at these.

I haven’t tested these myself since I just noticed this post. So to be sure, bug #1 and Bug #2 are also happening in the TMP Input Field. Correct?

Do you have some video showing Bug #1 and #2?

1 Like

I will record a bug reproducing video for TextMeshPro as well, just a moment.

1 Like

I have made a video for my bug report to TextMeshPro, it has the same bug#1 and bug#2 that I described here, and the ways to reproduce the bugs are the same as the Unity’s.
I also have committed my testing project to GitHub, here is the link:
https://github.com/h3902340/TMPChineseBugReport
For convenience sake, this project has already contained two free Chinese fonts, one is HanaMinA.ttf, the other is SourceHanSerifTW-Regular.otf. And I have also built the font assets in the project, the custom characters file is also included in the project.
HanaMinA.ttf is available on: https://osdn.net/projects/hanazono-font/releases/68253
SourceHanSerifTW-Regular.otf is available on: https://github.com/adobe-fonts/sour...ase/SubsetOTF/TW/SourceHanSerifTW-Regular.otf

If we try both of these fonts, bug#1 and bug#2 are still there, so I can say that it is not because of the font file I am using. Note that we have to use “Microsoft Bopomofo” to type Chinese, and we have to hit “Ctrl” + “Space” to be able to type Chinese again if we insert Chinese word without hitting Enter.

Thank you for the video. I’ll take a closer look at these issues tomorrow.

How are you entering the text? IME, keyboard, virtual keyboard?

Out of curiosity, how does Microsoft’s virtual keyboard when entering chinese text?

Quick Tip: I noticed in your video that you navigated to the Placeholder and Text child components to change their point size.

Since this is something that I was constantly having to do when I first created the TMP Input Field, I added the ability to set the font asset and point size for both of these sub object via the main Input Field inspector as seen in the image below.

I was using a keyboard to type Chinese.
In the video, I typed “你好” as an example.
After we switch to Microsoft Bopomofo, we type “s”+“u”+“3”+“c”+“l”+“3”, this way, we will see that we have inserted “你好” in the textbox. After that, don’t hit Enter key, use mouse to click somewhere else, then we should be able to reproduce the duplicated Chinese characters bug.
And thank you for the tips!

When I type the character sequence you indicated, I get difference characters. I get the following “苏此” which is obviously incorrect. Although this should not prevent me from testing the issues you reported, I would like to figure out the correct keyboard / language configuration to get the correct characters.

Do I have the wrong language pack / keyboard selected?

4020454--347719--upload_2018-12-20_3-44-9.png

Hi, that’s not the language pack I was using. The language pack should look like this:
4020493--347722--Untitled-1.png

Search “Taiwan”, there is only one search result, that’s the language I am using. And in the Keyboards option, choose “Microsoft Bopomofo”.

As I am trying to test this, I am running into a strange behavior with this Bopomofo mode where it appears to work (ie. I can type composition strings) but then it stops to work where it is only inputs English characters. Like this mode gets disabled. If I go try to type in Word or in a browser the behavior is correct.

If I switch to Microsoft Pinyin, I don’t have this issue where once in Chinese mode, it remains this way.

I am curious to know if you are seeing the same behavior as I describe?

P.S. This appears to be another issue besides those you have reported. That is unless I am doing something wrong.

Yes, I have this issue as well. As I have described in the bug report, once we reproduce this bug, we have to hit “Ctrl”+“Space” to be able to type Chinese using Microsoft Bopomofo again.
Did you successfully reproduce the duplicated Chinese words bug I mentioned here?

I am able to reproduce the issue you reported so I’ll be focusing on that tomorrow.

I am also checking internally about the behavior with Bopomofo as this appears to be another issue which I guess we can call #4.

Many thanks. Yes, I should have separated this issue as the bug#4.

Is this CTRL + Space a known functionality to reset the input?

I actually don’t know why we can fix Bug#4 by hitting “Ctrl”+“Space”, I found this method by accident…
Normally, we don’t need to hit “Ctrl”+”Space” after finishing typing Chinese using Microsoft Bopomofo, this bug only happens on Unity.

Has there been any progress in this bug?

They said that they are planning to deprecate the current input system and replacing it with a new one. So I assume that this bug will also be fixed.
We can download the latest input system here:
https://github.com/Unity-Technologies/InputSystem

1 Like

Please let me know the outcome of your testing on the new system.

P.S. I would still like to see this issue resolved in the current / legacy system. I’ll check again internally to see if I can get an update on this.

1 Like

What specific issue are you referencing? The IME issue?