I’ve got a game where the player has to input text at various points throughout and it’s been an absolute nightmare going into localization, specifically with asian languages. At this point I’ve gone through and adjusted all our text input stuff to work with asian languages using the built in system IME’s for input and when it works it works, but it doesn’t always work.
The problem is that when using an asian keyboard input there’s usually an option to toggle between the native language and english characters. By default when I launch my game this is set to use the english input instead of the native language input. It’s possible to change this using shortcuts while in game (shift for chinese, shift + caps lock for japanese, etc) but ideally what I’d like is for the keyboard to use the native language IME when a text field is selected automatically since this has proven troublesome for our localization testers thus far.
I found this thread going over how the TMP input field automatically sets the IME composition mode when selected, but this doesn’t seem to set the input type. Is there any way to set the keyboard to use the native language IME for input by default instead of requiring it be changed manually? The only other lead I’ve come across is that the new input system seems to have a few extra methods of interacting with the IME, but I’m using the old input system with rewired so I’d really rather not have to rip everything out and replace it with the new unity input system if I can help it. But surely someone at some point has had to deal with asian text input on the old input system right?
Update: After some more poking around I found I could get keyboard and system language information from CultureInfo in System.Globalization. I also found a super useful script to help with interfacing with keyboard layout stuff here since otherwise the stuff from CultureInfo seems to be more about the system language rather than the keyboard input language. With one final hint from this unanswered unity answers question I thought I might have figured it out but… Nothing.
I’ve been able to change between keyboards of different languages, but I still can’t set the input mode within the same language. I’ve uploaded an image to maybe better help explain what I mean, unlike with languages that use the latin alphabet asian languages have an extra option next to them in the task bar. Here you can see me toggling between latin characters and japanese characters. The language stays as japanese, but this secondary input mode changes and is the cause of all my headaches.
I don’t believe this is possible. Our IME integration is not that advanced. If you can find the windows API calls to do such a thing then you could probably add this support yourself but we do not provide anything to do this. The new input system uses the same IME code, there’s nothing different.
Well, I’ve given up. As suggested I did some more poking into windows api stuff and found IMEMode which I think was what I needed. It has options specifically for asian languages so it looked promising. A big problem though was being able to actually access it though. It’s in System.Windows.Forms which sort of doesn’t seem to be included in unity.
I say sort of since the .dll is used by mono, and if I add it as a package (either the mono version or the windows version) then unity yells at me that there’s a duplicate. I went through this post trying everything there they mentioned to maybe get it working, and after jumping though a dozen and one hoops the thing that finally worked was using the System.Windows.Forms plugin from this StandaloneFileBrowser project. At this point though I’m way in over my head with this. It looks like System.Windows.Forms has this Control type setup for handling what input field or whatever is focused, and that seems to be where I’d set the IMEMode, but I have no idea how it relates to unity in any way. I did some poking into how to get the active control but at this point I’m starting to think it’s not worth it. I’ll just tell people to use the shortcut to toggle their input mode if anyone runs into it…
I think it’s fine to do that. If a user wants the IME to be in the native language then they will have already configured it to do so. Once it’s set that way it will keep that setting until they change it, which they may want to do at times.
Good day. friends I have a problem with this I am uploading the application to the play store but it returns a warnnig: It is possible that this element does not have a label that a screen reader can read. I was researching but couldn’t find anything about this. Can someone tell me how I can solve it and in the labels I have the name of each field, let’s say email and password. THANK YOU
I don’t belive you can customize the IME. Maybe try asking the accessibility team who know more about screen readers, this seems to have gone out of the area of localization Unity Engine - Unity Discussions