Search Unity

Android Keyboard issues

Discussion in 'Editor & General Support' started by SolidSnake, Aug 16, 2012.

  1. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    Hi All,

    I know this is not the place to file bugs (I already filed a bug for one of the issues using report bug from the editor)

    But I just wanted to share with you issues and frustrations I encountered with Android keyboard when i started porting my app from iOS to Android hoping that someone encountered similar issues :).

    The app has compose message section which requires the user to be able to press buttons and interact with Unity view while typing a message.. this works fine on iOS

    I am using Unity 3.5.5f3 PRO on Mac

    Issues noticed so far:

    1. When TouchScreenKeyboard.hideInput set to False

    • On old versions of Android, tested on 2.2 and 2.3 (HTC desire and Nexus One): no touch events are received to unity.. you can only type and dismiss the keyboard without being able to interact with Unity view

    • New versions of Android, tested on ICS (Google Nexus and Samsung galaxy S3): any touch outside the keyboard and the text field dismisses the keyboard

    Expected behaviour is to be able to interact with Unity view while the keyboard is shown

    2. When TouchScreenKeyboard.hideInput set to True
    You can interact with Unity view, however more issues will rise (This works fine if the TouchScreenKeyboard.hideInput = false):

    • Dismissing the keyboard with Back button (tested on 2.2, 2.3 ICS): works fine at the beginning, but once the app pause to the background then resumes the 1st event of back button dismisses the keyboard without changing the statuses of TouchScreenKeyboard instance (visible, active and done) will remain true as if the keyboard still shown. 2nd press on Back button will make the keyboard visible but toggles the statuses (visible active done) to false as if the keyboard is not shown.

    • Inputing certain characters such as £,€,¥,¿,¡ turns the values of the variable (text) to empty string.

    • Unable to change TouchScreenKeyboardType the keyboard will be always set to default

    Unless Unity fixes these issues.. we might have to write our own plugin for the keyboard.

    Did anyone else encountered similar issues?

    Many Thanks

    Yas
     
  2. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    No one!! :)
     
  3. GamerCB

    GamerCB

    Joined:
    Jul 5, 2012
    Posts:
    3
    I am having lots of trouble using the TouchScreenKeyboard which I tried to use last week. Turning the hide input on and off has changed how it works in very odd ways and now testing on iOS doesn't seem to pass the entered in value back to my target text field (was working fine in Android). The visible flag doesn't seem to work at all as I have a HTC Desire S that has a hide keyboard button that doesn't set it. I cannot detect if it is hidden with any of the available parameters.

    Can I assume this is a really buggy system??? (Am using the same version)

    Let me know if you find a good plugin!
     
  4. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    Seems buggy to me.

    we will launch our first version of the app with the bugs. and we might start working on the fix in the next release

    :) I am still hoping that Unity will fix these issues. Maybe keyboard issues are not on top of their list at the moment (might be true for most games)

    If we find any solution I will post it.
     
  5. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    From what I've found out it does seem like a bug, if you could report it and post the case number that would be great!
     
  6. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    I 've already submitted a bug report back in July

    the case number is: 479234

    I also sent a detailed email once I was contacted for further details
     
    Last edited: Sep 17, 2012
  7. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    I saw you sent another follow up e-mail, I'll have a nosey for you
     
  8. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    Thanks alot!
     
  9. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    Looks like this has been fixed for 4.0 but not in 3.5 I'm afraid
     
  10. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    I see...

    At least its fixed :)
     
  11. tagabalon

    tagabalon

    Joined:
    Oct 12, 2012
    Posts:
    3
    Hi!

    This bug has been... uhm, bugging for the last couple of days. You said it's fixed on Unity 4, but does anyone have a quick fix for this? For 3.5? Any solution? Upgrading to 4 is not an option right now. Or if ever anybody found/made a good plug in, that could help too.

    Thanks! :)
     
  12. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    The bug has been fixed in 3.5.6.
     
  13. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    I tested the latest version of Unity 3.5.6 ... Didn't see any difference in regard with the keyboard :-(

    Did they fix all the issues mentioned?
     
  14. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    So sorry, I got this mixed up with another bug! I'm really sorry for the misinformation, as far as I know it's not fixed but I'm chasing it up.

    *Edit* I have word that something was fixed for 3.5.6 but I am just investigating what. I'll get back to you.
     
  15. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    Ok, Thank you!
     
  16. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    Just as an update:

    I got a reply from Unity QA regarding the issues and bugs:

    - Simultaneous interaction (keyboard and Unity view) was not planned and the actual planned behavior is to dismiss the keyboard when the user touches outside its area (both ios and android)
    - Other bugs have been assigned to developers
     
  17. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    Yes, I've been seeing the stir this has caused :p
     
  18. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
  19. skullthug

    skullthug

    Joined:
    Oct 16, 2011
    Posts:
    202
    Any status on this bug?
    I'm currently finding myself in a similar ugly mess :(
     
  20. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
  21. skullthug

    skullthug

    Joined:
    Oct 16, 2011
    Posts:
    202
    I forgot to come back and update, I tried the latest Unity 3 and that fixed my issues. Phew!
     
    Last edited: Jan 2, 2013
  22. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    @skullthug What were your issues?

    On my side I can confirm that the characters issue is fixed.... but the keyboard statuses after the app goes to the background still the same
     
  23. skullthug

    skullthug

    Joined:
    Oct 16, 2011
    Posts:
    202
    My issue was with the keyboard not reporting correctly to Unity when it had closed, so my keyboard IEnumerator would get stuck in its waiting loop.
     
  24. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    Had to update this thread since character '#' is still producing the old problem with empty strings from Android keyboard when hideInputs = true (tested on Unity 4.1.3)
     
  25. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    We've updated the app with Unity 4 now.

    Most issues with the keyboard were resolved apart from the interaction with Unity with native input for keyboard which is really a shame...

    After this experimental version of Avatar Messenger we will try to make our own Android keyboard plugin instead of using unity's to have better compose message experience

    Link to Google Play

    $unnamed.jpg
     
  26. Mey

    Mey

    Joined:
    Dec 25, 2012
    Posts:
    5
    We have encountered one of the bugs you have mentioned:
    New versions of Android, tested on ICS (Google Nexus and Samsung galaxy S3): any touch outside the keyboard and the text field dismisses the keyboard
    on unity 4.1.5f1.
    Drove me crazy till I found this thread now...
    Any news on that? SolidSnake - what's unity's official stand on this at the moment? After all it's been known for at least a year now...
    Did you find a plugin that you can recommend on?
    Regards,
    Meyrav
     
  27. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    Hi Meyrav,

    I understand your frustration as I feel the same way
    Unity response was

    "Thank you for such a detailed reply.
    I would like to give you an update on the current situation regarding touch screen keyboard input.

    I've talked with our Android and iOS developers and they told me that we do not support simultaneous interaction with the game and on screen keyboard and if that works somewhere - that is only a lucky coincidence. That means it can stop working on iOS at any point in time and it will not be fixed.

    Now regarding the bugs and wrong behavior that you've described in your e-mail. The 1st part "When TouchScreenKeyboard.hideInput set to False" you mention that no touch events are received on pre ICS devices and the keyboard is dismissed on ICS devices when the area outside the keyboard is touched. This behavior should stay in Unity 3.5.x, but in Unity 4.0 keyboard will be dismissed on all Android versions when the outside area is touched. There was a bug that would prevent the keyboard from reappearing after it was dismissed by touching outside of keyboard area but it was already fixed. The 2nd part "When TouchScreenKeyboard.hideInput set to True" indeed has a couple of bugs that must be fixed. First I want to remind you, that the ability to receive simultaneous input in game and in keyboard on screen can disappear at any point in time, but while it works, you can use it if you want. The bug regarding the visible, active and done statuses of the keyboard was fixed and they should be correct even after the application resume. The bug with certain special characters that makes the input string empty is still present, but it is assigned to developers and should be fixed. Finally, the last issue that you can not change the keyboard type to anything but default might be an issue with the documentation. I think that the documentation about this is not very clear and I will investigate it now, but I can't promise that this will be fixed."


    at the moment this happens only when you have the native text input visible as I mentioned previously and we did it in Avatar Messenger.

    I couldn't find any plugin that solves this so we are implementing our own at the moment (using Android plugins route)
    the initial result seems that if you have the keyboard in separate window then Android limits the touch and we got the same result as Unity's current implementation.
    However when we included the keyboard inside the same activity as Unity's it worked as we expected but without overlaying Unity view (the keyboard pushes unity view upwards when displayed)
    Ideally Unity should implement it in this way as it is the expected behaviour in most cases. I am guessing they didn't see it as important.

    I will have to check once we have a working solution whether we can share it with unity's community
     
    Last edited: Aug 5, 2013
  28. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    442
    Ran into same problem here. Hard to offer a nice user experience to user like many other games do, while hideInput does not work properly, nor allows you to have simultaneous input guaranteed. Also, hideInput is completely broken on Android 4.2+, no backspace gets sent. It also does not show the correct keyboard when I ask for the "email" keyboard for example with hideInput to true. Ugh. I wish there was a good plugin for iOS/Android that took care of all this or that Unity would put a tiny bit more effort into this. =(((
     
  29. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    Same problem here. The whole touchscreenkeyboard thing is not that useful. Not all keyboard types are supported (at least for iOS, Android I can't say exactly), closing keyboard from code is not supported, getting the keyboard size is only for iOS,... if there where a plugin in for all that, I would buy it :)
     
  30. Mey

    Mey

    Joined:
    Dec 25, 2012
    Posts:
    5
    Thanks SolidSnake,
    We have implemented a new algorithm to work around the simultaneous input issue , based on the response you got I understand now I should probably enable it in iOS as well.
    Now we are facing a different issue : we need to prevent the usage of non- english characters. the "TouchScreenKeyboardType.ASCIICapable" prevents it in iOS but not in Android.
    is this the issue you were referring to as default keyboard?
     
  31. Pratap-Dafedar

    Pratap-Dafedar

    Joined:
    Aug 30, 2013
    Posts:
    22
    Hi there,

    Is there any way available to change the default look (full screen) of keyboard in android when it's in landscape mode. I want see a normal keyboard (half visible) when i use the text field in landscape mode. Can any one suggest soon.. please..
     
  32. chainchoonoi

    chainchoonoi

    Joined:
    Nov 10, 2013
    Posts:
    1
    I have same problem too
    see PM,SolidSnake

    ps. I very like you name lol
     
  33. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    442
    Native keyboard support is just very lacking on iOS/Android.. SOMEONE make a Unity plugin!! Will insta-buy =)
     
  34. GonzoCubFan

    GonzoCubFan

    Joined:
    Oct 21, 2011
    Posts:
    70
    We have also run into the simultaneous input with the keyboard on both Android and iOS recently. IMHO, it's rather silly to actively refuse to support this. For one thing, it means any sort of in-game chat system you might want in a multiplayer game is impossible.

    We have solved the problem (more or less) for iOS by using a post-process to "patch" they Keyboard.mm source file that Unity provides. Of course, this means that we have to review these patches every time we switch to a new version of Unity.

    As yet, we have no solution for the problem on Android. SolidSnake or Mey, if you have any pointers or suggestions on how to go about this, It would be greatly appreciated.

    It's so sad that Unity just washes their hands of this problem. As some one else commented, "it's a shame".

    = Ed =
     
    Last edited: Dec 11, 2013
  35. GonzoCubFan

    GonzoCubFan

    Joined:
    Oct 21, 2011
    Posts:
    70
    +1
     
  36. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    We've updated our app and implemented a plugin for android for now (which is not working properly with Unity 4.3 update) but did the job for our usecase. more details on the app: http://forum.unity3d.com/threads/236347-Avatar-Messenger-2-0-for-Android

    Video demo including the messaging screen:


    I am trying now to convince my employer to publish the plugin as an asset or even open source it but its not straight forward...

    I still don't understand why a decent keyboard implementation is not a priority for Unity.
     
  37. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    442
    Agreed, you would think this is a core feature that Unity would place some minimal effort on. No idea if they monitor these threads though.
     
  38. SolidSnake

    SolidSnake

    Joined:
    Dec 19, 2011
    Posts:
    63
    I think its used to be easier with a smaller community... This thread was noticed at the early stage by Aurore who is a community manager which helped at least in fixing quite few small bugs but not in changing their core implementation of the keyboard as their QA reply indicated
     
  39. Dougomite

    Dougomite

    Joined:
    Jul 15, 2011
    Posts:
    58
    So I followed the rabbit hole of this touchscreen keyboard isues on Android all the way here. This has definitely been the most helpful thread but sounds like there is still no solution outside of making your own plugin. Well I guess creating native mobile plugins is something I should learn eventually.

    Hey SolidSnake, any advice or gotchas that would be useful to know as I try to recreate what you all were able to do with the native keyboard? All I have to go on is the Unity Doc for creating a native plugin and the Android docs about handling input method visibility.

    http://docs.unity3d.com/Documentation/Manual/PluginsForAndroid.html
    http://developer.android.com/training/keyboard-input/index.html
     
  40. WildMaN

    WildMaN

    Joined:
    Jan 24, 2013
    Posts:
    128
    So has anybody managed to write the plugin and sell it? Will purchase right away!
     
  41. spart

    spart

    Joined:
    Aug 23, 2014
    Posts:
    1
    Does anyone know the status of this bug:

    Inputing certain characters
    such as £,€,¥,¿,¡ turns the values of the variable (text) to empty string.

    We have an in-game chat system for our game in production, and our international players are unable to type any non-ASCII characters!
     
  42. OhYeahDev

    OhYeahDev

    Joined:
    Jul 12, 2015
    Posts:
    3
  43. Rakeshchatra

    Rakeshchatra

    Joined:
    Feb 28, 2013
    Posts:
    6
    There's no easy solution.
    The keyboard which is shown is the Android OS standard keyboard. (I think I've seen the similar in the other apps).
    You always can write a plugin on your own, but it's even harder to make it work on all the devices.
     
  44. ptr_ilya

    ptr_ilya

    Joined:
    Mar 21, 2014
    Posts:
    2
    2019.3, still not fixed...
     
  45. rainandgames

    rainandgames

    Joined:
    Aug 6, 2018
    Posts:
    12
    I'm having this problem as well. Using Unity 2020.1.0b13.3980.

    All I want is to be able to interact with the area not covered by the keyboard while it is open and not have the keyboard automatically close.

    I've noticed the unity app Hearthstone for android has figured out some way around this. In that app you can chat with someone and while the keyboard is open you can drag the chat log scroll view up and down and the keyboard remains open. As far as I can tell it is using the default android keyboard too.
     
    Last edited: Jul 23, 2020
  46. S0paTa

    S0paTa

    Joined:
    Feb 13, 2020
    Posts:
    4