Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

New input system - webgl and touch

Discussion in 'Input System' started by MythicalCity, Jun 13, 2020.

  1. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    408
    Hi, I am trying the new input system and it works great on webgl for mouse/keyboard but touch doesn't work on webgl. With the old input system touch is automatically working in UI and things like getaxis horizontal, but with new one even the UI doesn't respond to touch input (obviously this is on mobile devices that have touch in the browser).

    Is there something special that needs to be added to accept touch for webgl?

    I have the default UI actions setup:
    https://share.getcloudapp.com/P8ueReyX
    https://share.getcloudapp.com/qGuKoKl4
     
  2. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    408
    Bump, any suggestions? Is this a bug with the input system or does it just not support WebGL touch?
     
  3. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,394
    Hi @MythicalCity, sorry to leave you hanging.

    Did you replace StandaloneInputModule with InputSystemUIInputModule? Is the UI working with the mouse?

    Touch on WebGL is expected to work at least to the same extent it does in the old input system.
     
  4. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    408
    Thanks for the reply. Yes, as per my screenshot above, https://share.getcloudapp.com/qGuKoKl4 I have that module and the UI works great with a mouse, just no reaction for UI or anything else with touch.
     
  5. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,394
    Would you mind filing a ticket with the Unity bug reporter? ("Help >> Report a Bug..." in the editor's main menu) This should get looked at on our side.
     
  6. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    408
    OK I have made a reproduction project and submitted it here is the bug number 1257101
     
    Rene-Damm likes this.
  7. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    408
    BTW, just an update, if I add the code: Input.GetTouch(0).deltaPosition then the touch control works, but I guess that is using the old input system and new one at the same time.
     
    Last edited: Jun 22, 2020
  8. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    408
    @Rene-Damm any luck looking into this issue? I have a project deadline coming up that needs to add touch support so it would be great to know if this is just a user error on my end or an issue with the input system.
     
  9. MikeBru

    MikeBru

    Joined:
    Mar 28, 2016
    Posts:
    2
    running into a similar issue with webgl and touchscreen support. seems like an input system issue. Curious if there is a solution though.
     
  10. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    408
    I haven't heard back yet from Unity about this or the bug report I made (which is pretty typical, I've never heard back about bug reports I've filed so not sure whether we should expect a reply) probably best to just find a workaround. For now I implemented the touch with duplicate code that uses the old input system Input.Touches... which works fine in combination with the new system, it just means you'll have twice the code to do the same thing.
     
    MikeBru likes this.
  11. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    408
    @MikeBru just actually heard back from someone at unity, they said they won't fix the issue until mobile is officially supported for webgl.
     
  12. MikeBru

    MikeBru

    Joined:
    Mar 28, 2016
    Posts:
    2
    @MythicalCity thanks for passing on that update. I suppose it will be awhile before we see that feature then. You don't happen to know when Unity is planning to bring Webgl support to mobile per-chance?
     
  13. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    408
    No sorry, I have no idea.
     
  14. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,394
    AFAIK there's no near-term plans WRT mobile support for WebGL. However, touch support for WebGL in the new input system backends is already implemented and shipped so from all I know at this point, this looks like it's simply a bug. Looking into the status of the ticket.
     
unityunity