Search Unity

Bug Touch input not working correctly on Windows touch screen

Discussion in 'Input System' started by MikkoK-HS, Apr 13, 2022.

  1. MikkoK-HS

    MikkoK-HS

    Joined:
    Sep 26, 2017
    Posts:
    53
    Hi

    I'm having trouble running my project on a windows touch screen. Touch input doesn't seem to work correctly and I just get the Windows touch effects that you see on desktop on top of my Unity application (the circle for taps and square for holding). Simple taps (action type button, path Primary Touch/Tap and Tap interaction with default settings) don't do anything and moving my finger on the screen doesn't seem to register (action type value, path Position [pointer]). Value type (Vector2) action with Primary Touch/Touch Contact? [Touchscreen] modifer and Primary Touch/Position [Touchscreen] binding with a default hold interaction works while holding my finger in place, but stops as soon as I move my finger.

    Is there something I should do to get the new input system working on a windows touch screen?
     
  2. MikkoK-HS

    MikkoK-HS

    Joined:
    Sep 26, 2017
    Posts:
    53
    I should add that on the device simulator everything works correctly, it is only after I build and try running the application on a windows pc with a touch screen that I get these problems.
     
  3. PaulNK

    PaulNK

    Joined:
    Apr 8, 2015
    Posts:
    27
  4. MikkoK-HS

    MikkoK-HS

    Joined:
    Sep 26, 2017
    Posts:
    53
    Apparently this is a different problem. Doesn't work in windowed mode or on 2022.1.0b16.
     
  5. MikkoK-HS

    MikkoK-HS

    Joined:
    Sep 26, 2017
    Posts:
    53
    After some testing I've noticed that a tap is not a tap if the touch moves even a little during the tap duration. Apparently the touch on my touch screen is not very accurate (or is too accurate depending how you want to look at it) and there is always some jitter in the position so that's why taps don't work. Doesn't explain why moving my finger cancels touch contact modifier though.
     
  6. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    Last edited: Apr 16, 2022
    MikkoK-HS likes this.
  7. MikkoK-HS

    MikkoK-HS

    Joined:
    Sep 26, 2017
    Posts:
    53
    Here's a simple test project and build that illustrate the bug if anyone at Unity wants to take a look or someone else wants to verify on another device:

    https://www.dropbox.com/s/6xwnwqu5sncqv31/touchtest.zip?dl=0

    Created and built on Unity 2022.1.0b16.3019. Tested also on Unity 2021.2.18.

    upload_2022-4-19_10-28-16.png

    It tracks:
    • IsPressed, WasPressedThisFrame, WasReleasedThisFrame for Button type action with Touchscreen/Press binding
    • WasPerformedThisFrame for Button type action with Primary Touch/Tap [Touchscreen] binding
    • Vector2 Value type action's value with Primary Touch/Position [Touchscreen] binding
    • Vector2 Value type action's value with Primary Touch/Delta [Touchscreen] binding
    • A UI button that changes the text to "Clicked" when clicked

    On my touch screen:
    • Shows IsPressed correctly as true when I hold my finger in one position, however if I move my finger IsPressed becomes false and doesn't become true until I lift my finger and press again. It allows for very tiny (a few units/pixels) movements but if I move my finger by any significant amount the press fails.
    • WasPressedThisFrame seems to work correctly
    • WasReleasedThisFrame works only very rarely if I keep tapping the screen in rapid succession.
    • Tap works when WasReleasedThisFrame works
    • Touch position updates if I hold my finger in one place but becomes (0, 0) if I move my finger. It won't show a correct value until I lift my finger and press again. Seems to have the same problems as IsPressed
    • Touch delta updates when the touch starts but shows only (0, 0) if I move my finger. Again seems related to the IsPressed problem
    • UI Button has the same problem as WasReleasedThisFrame and Tap, only works very rarely if tapped on rapidly multiple times.
    The screen is a Finlux IF75T633/7 75" touch screen, it shows in Windows devices as a "multi touch overlay device". On the device simulator everything works as expected, I haven't tested on any other devices.
     
    sacb0y likes this.
  8. ABatesPKL

    ABatesPKL

    Joined:
    Apr 26, 2022
    Posts:
    1
    I am having this issue at the moment, taps don't register correctly if you slightly drag your finger on the screen.

    Your sample application confirms this as well.

    Is there any fix or workaround for this yet?
     
  9. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    No even the Third Person Sample touch screen joystick doesn't work on windows.

    I'm surprised they aren't aware of this.
     
  10. dnorambu

    dnorambu

    Joined:
    Sep 14, 2021
    Posts:
    11
    Same issue here. I'm developing an app for Windows with touch screen. In Android it works perfectly, both Editor and Build, but according to my client feedback, buttons behave in the same way as MikkoK's example project.
    Unity Editor: 2021.3.0f1
     
  11. Ecocide

    Ecocide

    Joined:
    Aug 4, 2011
    Posts:
    293
    I tried to upgrade our simulation game from Unity 2020.1 to the current 2022 version and while everything else seems fine the touch input from Windows is indeed not working anymore. We still use the old input system. Anything I forgot to enable here? It is a major update and there are a lot of new settings in Unity.
     
  12. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    Based on this...
    What's new in Unity 2021.3.5 - Unity (unity3d.com)

    > Input: Fixed Touchscreen.pressure being corrupted on Windows Standalone with input system package. (1378194)

    Maybe it's been fixed? I haven't been able to test yet.
     
    dnorambu likes this.
  13. zaniocz

    zaniocz

    Joined:
    May 9, 2011
    Posts:
    24
    Thank you, it seems the problem is fixed previous to 2021.3.5, at least the problems evidenced in the project shared by MikkoK-HS
     
  14. MikkoK-HS

    MikkoK-HS

    Joined:
    Sep 26, 2017
    Posts:
    53
    I just heard back from Unity regarding my bug report and they said they won't fix this because they don't support "touch events on secondary displays" whatever that means. I guess they only want to support touch screens on mobile devices? Sucks to be us I guess, luckily we are already migrating to Unreal Engine.
     
  15. Selek-of-Vulcan

    Selek-of-Vulcan

    Joined:
    Sep 23, 2021
    Posts:
    78
    Hmm, I've been thinking of buying a Microsoft Surface Pro or Surface Laptop Studio to run Unity, as touchscreens are easier on my hands than mice or trackpads. But maybe I should rethink? Does the Surface work with Unity?
     
  16. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    In the engine? No, unfortunately a lot of programs aren't modern enough to support touch. Would be lovely with my surface studio laptop but nope so many programs lack it.
     
  17. Selek-of-Vulcan

    Selek-of-Vulcan

    Joined:
    Sep 23, 2021
    Posts:
    78
    @sacb0y Thanks for your reply. Yeah, that's what I was asking -- does the Unity Editor recognize touch input? It sounds like it does not. Rats.
     
  18. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    Yeah, I adore my surface, but so many apps are still stuck in the early 2000's in terms of mouse input even.

    Only drawing apps seem to care enough to be modern.
     
    Selek-of-Vulcan likes this.
  19. BjoernS

    BjoernS

    Joined:
    Nov 14, 2012
    Posts:
    5
    we had similar problems with a touch screen and windows 10 and windows 11: the "touch drag" was not working correctly - and canceled the drag.
    our partially solution was: change the "pointerBehavior" of Unity's "InputSystemUIInputModule" of the EventSystem to "SingleMouseOrPenButMultiTouchAndTrack".
    but this had a negative effect: toggles cannot be pressed with a quick touch - only with a longer hold press time...
     
  20. TechCenterUser

    TechCenterUser

    Joined:
    Jun 8, 2020
    Posts:
    5
  21. vallentes

    vallentes

    Joined:
    Sep 2, 2023
    Posts:
    1
    here is touch control with no other needs for buttons

    You can thank me at revolut.me/vallentes

    spend 3 weeks on this to get it working with no buttons
    just touch screen
     

    Attached Files: