Author Topic: [BUG] IMECompositionMode.On breaks backspace in UIInput on OSX webplayer.  (Read 3156 times)

wwweh

  • Guest
As per the title. This must be set to off for OSX webplayer backspace input in NGUI to work.
« Last Edit: February 20, 2013, 12:55:29 PM by wwweh »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [BUG] IMECompositionMode.On breaks backspace in UIInput on OSX webplayer.
« Reply #1 on: February 20, 2013, 08:40:06 PM »
Sounds like a bug in Unity.

MentalFish

  • Guest
wwweh, did you submit this as a bug to Unity? I am still experiencing this problem.

marasto

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
HIi
I had submitted a bug report too.  ;)

Regarding the issue:
A Potential solution could be on UIInput or UICamera using the OnGUI method and checking for key press here using the Event class (or storing the last event).
(Don't know why, but on OSX at least, the OnGUI Event always report the None key pressed apart the backspace :) that is not reported to Input)

If the event isKey and backspace is pressed just add the \b button to the input (if not already added) or update current string and then notify the OnInput as usual.
However because the OnGUI is called after all the Updates and all the OnRenderXXX the label didn't get updated that frame but potentially at the next. Not a big issue indeed but break a little some logics.
So probably it is better to cache the results, merge with the new input string (if another key has been pressed meanwhile) and then process the text in UICamera update as usual.

It is a workaround of course but better than nothing. However I don't know if the OnGUI is called. Could I ask Arenmock some help to eventually integrate that workaround (without it introduce any subtle issues I don't know) ?

Regarding IME in general i noticed that the behaviour of UIInput is a bit weird. It append the composition string after the other texts instead of substitute them (like the standard GUI.TextField does). Why it work that way ?