Search Unity

Input problem when keyboard is opened on Android

Discussion in 'UGUI & TextMesh Pro' started by Emptiness, Sep 14, 2015.

  1. Emptiness

    Emptiness

    Joined:
    Jul 14, 2012
    Posts:
    33
    Hi, when the keyboard is opened on Android Unity can not detect any touch or button press on the device except on the keyboard. So the keyboard works fine but the part where the the keyboard is not covering the screen there isn't any touch detection.
    It's like there would be an invisible cover or something on the part of the screen where the keyboard is not covering the unity app.

    So the user have to touch the screen twice in order to push a button when the keyboard is opened.

    Example:
    1. user touches an inputfield
    2. keyboard opens
    3.keyboard working correctly
    4.user decides to push a button on the area of the screen where the keyboard is not covering the app. So the user touches the screen.
    5. The unity app does not response to the touch, instead it closes the keyboard. (the touch is not registered even with Input.touchCount)
    6.The user has to press the button again (touches the screen) and than unity responds correctly.

    Obviously I don't set up something correctly :)
    Can someone help me?
    Thanks in advance.
     
    Last edited: Nov 7, 2016
    Ardito92ITA likes this.
  2. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    227
    I think this is by design and a common behavior on mobile, not exclusive to unity.
     
  3. Emptiness

    Emptiness

    Joined:
    Jul 14, 2012
    Posts:
    33
    Hi all,

    One year passed and it is still an unresolved issue which cause ongoing problems to my users. All my clients and all my testers said this is unacceptable.

    I don't think that this is a common behavior on mobil application, or at least this is not common for the popular apps(googlemaps, facebook, foursquare, tripadvisor...).
    This is quite annoying for a user to push the same button twice because the first touch exit the keyboard and the second touch will actually push the button. This could not have been intentional by Unity. This is an annoying bug from the view of UX(User Experience).
    It seems that I'm not the only one who have problem with this because here is an asset to solve this issue:
    https://www.assetstore.unity3d.com/en/#!/content/41707

    And another issue is that it is currently impossible to detect when teh user hits the "done" button.

    Is there any solution for this bug?
     
  4. GravyGaming

    GravyGaming

    Joined:
    Nov 25, 2015
    Posts:
    8
    Hey,

    The same problem two years later. Unity team, please any position from you!?
     
  5. Allah_420

    Allah_420

    Joined:
    Feb 5, 2017
    Posts:
    2
    If anyone interested, this problem is still not solved... 2019 on the calendar)
     
    Last edited: Mar 28, 2019
  6. milesmajefski

    milesmajefski

    Joined:
    Sep 4, 2013
    Posts:
    9
    Still a problem in Unity 2019.1.8f1. This is not normal mobile behavior, any chat or email app on Android detects touches when the keyboard is open.
     
  7. sanketrandive

    sanketrandive

    Joined:
    Jul 5, 2018
    Posts:
    3
    Does anybody solve this...?
     
  8. Saulius

    Saulius

    Joined:
    Aug 10, 2010
    Posts:
    21
    Have the same problem. I bet client wont be happy about it. And seems there is no way to fix this... Using unity 2019.1.4
     
  9. sangnv00452

    sangnv00452

    Joined:
    Dec 23, 2014
    Posts:
    2
    Hello, anybody here?
    I need answer for this problem too :(
     
  10. Yakirbu

    Yakirbu

    Joined:
    May 7, 2015
    Posts:
    28
    This is not a normal behavior, I've seen many games and apps that bypass this limitation that Unity has.
    Why is this thread silenced?
     
  11. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    I started to hate the way unity handles keyboard. I simply want to add a chatting mechanics to my game like simple whatsup. No way. Keyboard is keep closing. No UI response while keyboard is open. I want to tag some staff about this. Maybe @phil-Unity
     
    Ardito92ITA and Alex_F like this.
  12. Unity3dteacher

    Unity3dteacher

    Joined:
    Dec 14, 2012
    Posts:
    197
    same issue occurring here also
     
  13. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    300
    I also have this same problem. Please help me! My boss hate this ux and I can't find any work around. :(
     
  14. Unity3dteacher

    Unity3dteacher

    Joined:
    Dec 14, 2012
    Posts:
    197
    same issue unity only want to solve this .my boss also dont like this
     
  15. eclipse130300

    eclipse130300

    Joined:
    Dec 6, 2019
    Posts:
    34
    Same issue as well! Android keyboard works terribly at any circumstances. It doesn't return area, work with ui and so on.
    About this topic - try to open chat in Hearthstone (as I know it's developed via unity) when keyboard is opened you CAN press back button. Does anyone know how to achieve it? Are there HS developers around? :)
    P. S. btw the keyboard won't be closed until you press back button. May be try to keep a keyboard on the screen?
     

    Attached Files:

    Last edited: Jun 27, 2020
  16. Henry_Xie

    Henry_Xie

    Joined:
    May 30, 2020
    Posts:
    5
    Same issue and it's almost 2021:( Does anybody solve the problem?
     
  17. Unity3dteacher

    Unity3dteacher

    Joined:
    Dec 14, 2012
    Posts:
    197
    no still its a issue.
     
  18. AlphSa

    AlphSa

    Joined:
    Sep 21, 2019
    Posts:
    4
    same issue here. Any ideas how to solve it yet?
     
  19. Synthol67

    Synthol67

    Joined:
    Dec 17, 2020
    Posts:
    2
    I have already the same problem. I need also a solution. Our Customer can't use our app because of this behavior
     
  20. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    300
    The only solution right now is to use custom plugin(Advanced inputfield 2) on asset store.
    Even if Unity finish implementing it today, this change require an engine change and will not be back port to LTS version.
    I doubt they will finish it anytime soon if not ever. I saw a PR in the new inputsytem about touch screen keyboard. It seemed like they are trying to move the touch screen keyboard to the new system altogether(which will also not be finishing anytime soon).
     
  21. xaldin-76

    xaldin-76

    Joined:
    Oct 1, 2016
    Posts:
    25
    (Might be deprecated) (Probably needs some tweaking for ios)

    After many weeks I have finally created an acceptable solution: https://github.com/hesham-akmal/AnubisInputField

    It's a modified version of this custom android plugin: https://github.com/mopsicus/UnityMobileInput

    For now it only works with TMP input field as it inherits from TMP_InputField. Basically on selecting an input field, it will not show up the default unity's keyboard, instead it will create an android native EditText out of screen bounds (invisible). Then focus on that edit text which will show up native keyboard (which does not contain unity's keyboard invisible blocking screen ). When adding/removing characters in the invisible edit text, it will sync to unity's input field. The caret position is also synced now. There are more features such as letting keyboard on screen unless manually closed (android/ios).

    There's also a menu item "GameObject > Anubis > Replace all Tmp_InputFields with AnubisInputFields", to convert all TMP_InputFields in loaded scene automatically. While copying serialized data of course.
    Tested with Editor versions 2019.4.22 and 2020.3

    I will write up a documentation on the github repo soon. Everyone is welcome to try it :)


    Edit 24/Aug/2021:
    Thanks for everyone who is using my asset. Sadly I have got tired of maintaining this solution myself. I gave up and got the advanced input field 2 asset which does exactly like Anubis field. Link: https://assetstore.unity.com/packages/tools/gui/advanced-input-field-2-185464
     
    Last edited: Oct 25, 2021
  22. syedali

    syedali

    Joined:
    Jun 6, 2017
    Posts:
    8
    xaldin-76 likes this.
  23. ReneSchleese

    ReneSchleese

    Joined:
    Jul 11, 2017
    Posts:
    9
    So far I tested it only on my Android phone, but @HeshamAkmal s solution works! Good job!
     
    xaldin-76 likes this.
  24. kaan0550

    kaan0550

    Joined:
    Jun 2, 2019
    Posts:
    10
    xaldin-76 likes this.
  25. ReneSchleese

    ReneSchleese

    Joined:
    Jul 11, 2017
    Posts:
    9
  26. AtahanOzturk

    AtahanOzturk

    Joined:
    Aug 18, 2015
    Posts:
    9
    Hi @ReneSchleese It seems the page you linked to has the exact property that this solution needs. However in Unity 2020.3.15 for some reason TouchScreenKeyboard.Android does not exist :(
    TouchScreenKeyboard' does not contain a definition for 'Android'


    Any idea how your colleague used this?
     
  27. lewpie97

    lewpie97

    Joined:
    Dec 5, 2017
    Posts:
    2
    I'm not very clear but if I remember correctly it only works on 2020.2
     
    Last edited: Mar 31, 2022
  28. 2ez4tt

    2ez4tt

    Joined:
    Jan 31, 2016
    Posts:
    4
    marcozakaria likes this.
  29. marcozakaria

    marcozakaria

    Joined:
    Sep 17, 2017
    Posts:
    23
    Code (CSharp):
    1.     TouchScreenKeyboard.Android.consumesOutsideTouches = false;
    fixed my issue , now can move between multiple inputs easly
     
  30. ebobo225

    ebobo225

    Joined:
    Apr 6, 2020
    Posts:
    2
    I don't remember how, but I managed to do it with m_keyboard.active = true in the lateupdate loop.
     
  31. RahmatAli_Noob

    RahmatAli_Noob

    Joined:
    Sep 13, 2022
    Posts:
    74
    Hi There, I Have used It But in My Case when I try to Click outside of the touchscreen keyboard, I cannot click on the Any Other UI And also the touchscreen keyboard is Not Closing by clicking outside of the touchscreen keyboard.
    If there is Any details, Will you please explain it to me
    Thanks In Advance.
     
    Ardito92ITA likes this.