Author Topic: Blackberry UIInput Bug (Solved)  (Read 3178 times)

Thickney

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Blackberry UIInput Bug (Solved)
« on: July 08, 2014, 02:28:40 PM »
I've been testing on a Blackberry Z10 and when I'm entering text into a UIInput field it appends the entire input string again to whatever the user inputs. This happens when the user presses enter on the keyboard or otherwise closes the keyboard. A single character input string doesn't produce any duplicate text.

Everything works fine in iOS and Android builds.

For example, on Blackberry the input string "blah" -> [submit] produces "blahlah".

Is this something I can patch myself somewhere? I can't really update my version of NGUI as it breaks a lot of my widget anchoring.
« Last Edit: July 09, 2014, 10:06:10 PM by Thickney »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Blackberry UIInput Bug
« Reply #1 on: July 09, 2014, 02:56:09 PM »
Every single system supported by Unity has different input handling. That's a fact. Just look at UIInput.cs script and note how many different #ifdefs there are all over the place. It's a fucking mess, pardon my french. I get extremely frustrated whenever I have to touch that clusterfuck, and is easily the worst thing about working with Unity.

Whew, now that that's off my chest... Have a look at UIInput's Update function. My guess is that after you click the submit button on the BB's keyboard, Input.inputString gets set to something, which leads to it being added to the input (line 670 has the check). Can you confirm that that's the case? If so, we'll need to ignore the entire section on Blackberry devices.

Thickney

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Blackberry UIInput Bug
« Reply #2 on: July 09, 2014, 08:43:25 PM »
Haha oh so I get to dive right into that mess. Goody. Anyway, the version of NGUI I'm on is 3.5.9 and UIInput.cs line 670 is outside the scope of Update().

So I got it to work. I had to add a check to exclude Blackberry in this section of Update():
  1. string text = mKeyboard.text;
  2.  
  3. if (TouchScreenKeyboard.hideInput)
  4. {
  5.         if (text != "|")
  6.         {
  7.                 if (Application.platform != RuntimePlatform.BlackBerryPlayer) {
  8.                                                        
  9.                         if (!string.IsNullOrEmpty(text))
  10.                         {
  11.                                 Insert(text.Substring(1));
  12.                         }
  13.                         else DoBackspace();
  14.  
  15.                         mKeyboard.text = "|";
  16.                 }
  17.         }
  18. }
  19.  

Also I don't know if it has anything to do with this problem, but the mobile keyboard on BB10 doesn't have the extra bar on the top with a text preview and "Done"/"Cancel" buttons. I don't know if that's just Unity or BB10 not supporting it, but it's something I noticed.
« Last Edit: July 09, 2014, 09:59:21 PM by Thickney »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Blackberry UIInput Bug (Solved)
« Reply #3 on: July 10, 2014, 08:15:19 PM »
Hmm, that's a pretty old version of NGUI. There have been quite a few changes to that file recently, so you should really update to the latest first.