Author Topic: UIInput still not bringing up keyboard on Windows Store. Backspace not working.  (Read 14995 times)

pdelaossa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
We are having 2 problems related to UIInput in Windows Store compilations. I checked that these happen in both desktop, arm and x86 tablets (Surface and Surface Pro). We're updated to 3.7.6.

1st problem)
The keyboard doesn't open. I saw that you already call mKeyboard.active = true on Update when MOBILE is defined.
MOBILE directive is, however, not defined when we are in UNITY_METRO.
We were able to hack that problem adding (mKey = keyboard.Open(null); mKey.active=true; ) to OnPress.
But this is not a solution, and the behaviour is not the intended.
In Windows Store desktop there's no touch keyboard, so obviously it doesn't show up.

2nd problem)
The backspace doesn't work. The directional keys don't work neither, but those we don't use.
We tried tracking the methods up to DoBackspace->Insert("") and found that they are not even called in Windows Store compilations.
Neither desktop or tablet compilations detect backspace.
« Last Edit: November 20, 2014, 05:02:16 AM by pdelaossa »

brunoroma

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
+1 :( WIN PHONE 8.1 last NGUI UNITY 4.5.5.p5
« Last Edit: November 20, 2014, 11:37:58 AM by brunoroma »

Nerosam

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
+1 on this as it seems related to an issue I posted about earlier (in a different thread) in a video demonstration.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Hack that file to your heart's content. Modify whichever defines you need. I'll be honest -- I am sick and tired of hacking it. There are dozens upon dozens of hacks inside already, all done because of Unity's utterly shitty input support. Every platform supported by Unity has some platform-specific issues / glitches / bugs / absurdities. I've mentioned it countless times on this forum. Worse yet, different versions of Unity often break things that worked before.

So to sum it up: Unity's input support is shit, especially on WP8/WSA.

brunoroma

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
ok.. so the solution? or we have to leave NGUI vs uGUI?

is a money question I have game ready for WINPHONE 8.1 and no possibility to publish. The keyboard appears once for one second then disappears for ever :-[

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
I have the exact same problem here :/


Do you have something you can point us to? Like what part of the code we need to update or look at?
The thing is that TouchScreenKeyboard is not usable on a build for Standalone, so what are you using instead to display the keyboard?


I'll try to spend 1-2 day on this to have a fix, but don't really know where to start or even what method to call to show the keyboard on this platform (Surface Pro 2).

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Touch screen keyboard is opened in UIInput's Update() function on line 641. If there is a problem, that's where it will be. Log the events that occur, check to see which ones you get and in which order -- does OnPress get sent twice, perhaps? Once for mouse once for touch? That's usually the case with Unity, as they deemed it necessary to send both from the same action with no way to differentiate between real mouse events and the fake ones. Everything you need is in UIInput.Update().

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Will try to look into that, but there is a lot of code and I don't know what is the correct following of events etc...
Also hard to work directly on the SP2 that is really slow etc...

I'll let you know!

pdelaossa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
As I posted in OP, there's an easy hack that forces the keyboard to show up each time you click on the UIInput.

We force the keyboard to open directly in OnPress. This is the method Arenmook is using for the caret positioning/selection handling.

This means, adding the following code to OnPress (posting the whole method goes against the rules, but it is a small one):
  1. #if UNITY_METRO
  2.       var key = TouchScreenKeyboard.Open(null); // null is also not what we need here, but as a hack it is good enough
  3.       key.active = true;
  4. #endif

But showing the keyboard is only the first of the problems!

The second problem, which I wasn't able to bypass, is that the UIInput themselves don't receive the "Backspace" or "Arrow key"s key inputs.
Therefore, it is impossible to remove things you have written.

Anyone got any idea? I will try tracing back the events again, but from my first try:
  • He calls DoBackspace() inside ProcessEvent()
  • He calls Insert("") which theoretically replaces the last character with "" (empty character).

Nerosam

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
I'm currently in the process of switching UIInput with uGUI's "InputField" components. I needed to download the latest Unity 4.6 Beta for this but so far, the input implementation is working perfectly. I just have a Canvas object with the 3D world space option enabled on the same GameObject as the UIRoot script

I attempted to fix UIInput.cs for Windows Store Universal Myself but my efforts ended up being in vain. One fix would break something else.

Nerosam

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
It seems Unity 4.6 fixed the keyboard issue I was having with the keyboard on WP8 onthe UIInput script

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Hello.
You mean that using Unity 4.6 with the current version of NGUI works?


Thanks :)

Nerosam

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
Im currently on version 3.7.0 but things seem to be working for me on 4.6. Havnt fully tested though.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Thanks.

Will try when I can!

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Same thing for me using 4.6.
Absolutely not showing the keyboard on a Surface Pro device :(