Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

WebGL problem with input touch on Mobile

Discussion in 'Web' started by Danguru, Sep 14, 2015.

  1. Danguru

    Danguru

    Joined:
    Jan 14, 2011
    Posts:
    27
    I know Unity3D it's not ready for mobile,but i need to ask XD is there any chance to work with touch input on mobile???
     
  2. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    The Input.touches API will work on supported devices (though there is a bug where y-Coordinates are flipped currently, which is fixed in 5.3). So, if you can get your content to fit on a mobile browser, then touch won't be the problem.
     
  3. Danguru

    Danguru

    Joined:
    Jan 14, 2011
    Posts:
    27
  4. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
  5. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    ("Supported devices" should be anything sending html5 touch events).
     
  6. Danguru

    Danguru

    Joined:
    Jan 14, 2011
    Posts:
    27
    I could get Input Touches but they doesn't work with Touch Input Module on Event System
    why???
     
  7. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    And it works on a normal Android/iOS build? Can you provide that project folder in a bug report, and post the case # here? Than I can take a look.
     
  8. Danguru

    Danguru

    Joined:
    Jan 14, 2011
    Posts:
    27
    Yes works well on Android Build! I reported the bug #727581
     
  9. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Ok, I think I found the issue, Input.touchSupported would not correctly return true on WebGL, so the UI system thinks it cannot do touch. This will be fixed in 5.3. Will do some more testing, though.
     
  10. Danguru

    Danguru

    Joined:
    Jan 14, 2011
    Posts:
    27
    Thank you for the fixing , waiting 5.3 (i think few months) ......
     
  11. Worrier-Po

    Worrier-Po

    Joined:
    Sep 17, 2015
    Posts:
    1
    Hello Danguru, how to handle touch event?
    Your site works well on safari of ipad.
    Wonderful.
     
  12. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
  13. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    This fix has been shipped in Unity 5.3 a while ago. So, news on what?
     
  14. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    Fantastic.
     
  15. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    @jonas echterhoff

    I can't really get touch as input working in WebGL. It works great for UI elements, but OnMouseDown() or Input.GetMouseButtonDown(0) doesn't work even if Input.simulateMouseWithTouches is true. Why is that?

    What is it that the UI has, that other GameObjects don't?

    I'm using Unity 5.3.5f1
     
  16. v0kb0l0k

    v0kb0l0k

    Joined:
    Feb 21, 2013
    Posts:
    9
    5.4.0f1 same not fixed
     
    HypercubeCorp likes this.
  17. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Can you send a bug report with a repro project, and post the case number here? This thread was originally about Input.touchSupported, which has been fixed - but Input.simulateMouseWithTouches may be a different issue.
     
  18. v0kb0l0k

    v0kb0l0k

    Joined:
    Feb 21, 2013
    Posts:
    9
    Sorry, was our foult, it's all ok now:)
     
  19. teemukorh

    teemukorh

    Joined:
    Oct 28, 2014
    Posts:
    49
    I'm also having troubles with Input.touchSupported on 5.4.0f1. It always returns true, on desktop browsers and mobile browsers that I have been testing. Should it work?
     
  20. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Input.touchSupported always returns true because the WebGL platform supports touch. Even on Desktop browsers, this may be relevant, as some desktop OS allow touch input in addition to keyboard mouse input. I don't think it is possible from JS to detect if there is any actual touch hardware connected or not. So you should design your WebGL content to work with both touch and mouse input.
     
  21. teemukorh

    teemukorh

    Joined:
    Oct 28, 2014
    Posts:
    49
    That's a good point. Thanks for the clarification!
     
  22. Creer_LLC

    Creer_LLC

    Joined:
    Feb 28, 2017
    Posts:
    15
    Although this has been a while ago... Please i have been fighting with my webgl build (loglords.fansbox18.com/llweb), the input field doesn't pull up the keyboard on chrome on android marshmallow so i can't sign in or register from the mobile browser but i can do this from the desktop browser.

    Please a reply would be appreciated.
     
  23. Monsieur_D

    Monsieur_D

    Joined:
    Oct 31, 2013
    Posts:
    3
    I have the same problem here. The mobile phone keyboard is not appearing when I select the input field.

    I try TouchScreenKeyboard.Open() during the OnSelect event but nothing.

    TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, false, false, false, false, "");

    Anyone has an idea ?
     
  24. KellerDev

    KellerDev

    Joined:
    Feb 7, 2017
    Posts:
    59
    Should Input.touchSupported return true in the editor? I'm creating a web application but I cannot really test it for touch, because in the editor touchSupported always returns false. Is this normal? Will it return true on a tablet?
     
  25. chriszul

    chriszul

    Joined:
    Feb 13, 2018
    Posts:
    33
  26. nilton_felicio

    nilton_felicio

    Joined:
    May 17, 2012
    Posts:
    66
    I'm having the same problem. Input Text in WEBGL(Facebook), does not show the keyboard on the mobile(Galaxy S7).
    Unity 2018.2.7f1

    Is there no solution to this? :(
     
  27. A_never_kill

    A_never_kill

    Joined:
    Jan 7, 2014
    Posts:
    81
    I am having the same issue..is anyone resolved this or not ??
    if yes then please let us know your step .
     
  28. Uli_Okm

    Uli_Okm

    Joined:
    Jul 10, 2012
    Posts:
    95
    Hello guys, I managed to create a workaround for this problem and freely uploaded to github:
    https://github.com/dantasulisses/WebMobileInputFix
    I didn't test extensivelly but looks like it is working fine and the use is very simple.

    Currently I was told that this fix don't work in IOS, but i'm trying to test and make a fix as soon as possible
     
  29. esse-swann

    esse-swann

    Joined:
    Sep 19, 2015
    Posts:
    1
    Hey Uli, so it's actually doesn't work in IOS because of security restriction on IOS which allows to `.focus()` only from user input events. We tried fixing it, but the problem is that webgl intercepts the touch\click events so we cannot manually set focus to your `fixInput` from outside JavaScript. May be you have ideas on how to do it? We have devices to test :)
     
  30. nbkhanhdhgd

    nbkhanhdhgd

    Joined:
    Apr 19, 2016
    Posts:
    23
    Hi, I'm using this plugin in my project: https://github.com/eforerog/keyboardMobileWebGLUnity
    It worked for Android but have problem when you enter full screen => this plugin will exit full screen and can not scroll up/down on website.
    iOS: I'm testing => maybe not work.