Search Unity

Android - Pen not working?

Discussion in 'Input System' started by pertz, Oct 24, 2019.

  1. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    106
    Isnt class Pen working on Android?

    I bought 1 physical device with pen (Samsung Note 4) to try to debug, and the input with pen works fine on the UI (EventSystem/Input System UI Input module), but when I try to access it via code it's not working: Pen.current is always null (I'm checking it on every Update, and it's never non-null)

    I tried docking/undocking the pen several times, nothing changes. On Logcat I can clearly see the pen is working, there are several log messages when I dock/undock it, for example:
    D/PenGestureReceiver: onReceive() Pen Insert Action : true. mPenDetachOption : 0
    D/PenGestureReceiver: onReceive() Pen Insert Action : false. mPenDetachOption : 0

    And also as I said on the UI the pen works fine.

    As a fallback I try to read the pen as mouse using the old input (which always worked) and it also doesnt work, but I guess this would be a new bug of the old input (stopped working in 2019.2).

    Any ideas? Any workaround/idea is welcome, Im kinda stuck here and getting lots of bad reviews since old input isnt working for pen on Android and it seems the new input system also isnt.
     
  2. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    106
    The only workaround I can think of is adding an invisible layer on UI, getting the touches/clicks there, then converting to world coords. But this would be a major rework on my input module.

    @Rene-Damm any workaround/fix/tests I could do?
     
    Last edited: Oct 24, 2019
    gilbertoPlayX likes this.
  3. gilbertoPlayX

    gilbertoPlayX

    Joined:
    Sep 23, 2019
    Posts:
    7
    @pertz i have a similar problem but only on some devices in my case Samsung s7 edge and with touch not even a pen.
     
  4. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    106
    @gilbertoPlayX I'm getting several bad reviews and bug reports from players regarding the input after I migrated to the NIS, but the pen was the only one I could consistently reproduce. The others I dont even bother reporting because for Unity team if you cant consistently reproduce it then the bug doesnt exist, they dont even care
     
    gilbertoPlayX likes this.
  5. gilbertoPlayX

    gilbertoPlayX

    Joined:
    Sep 23, 2019
    Posts:
    7
    also, i notice when i send apk to my team test if they didn't clean their cache before start playing new apk version the game has a different behavior like its a combine version between the older and new builds.
     
  6. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    106
    I ended up doing this workaround, it seems to be working fine on my test devices, including pen. I will check in production with the players now.
     
    gilbertoPlayX likes this.
  7. Mathijs333

    Mathijs333

    Joined:
    May 20, 2014
    Posts:
    15
    Hi! Same issue here. Samsung Note 3.

    We've included the new input system next to the old one and end up using Pointer.current.press. ...

    But,... scrollrects are not working either. Have you got them working?

    And, is there a bug report yet?

    regards.
     
  8. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    106
    Scrollrects were working fine for me on the new input if I recall correctly.

    Last week I ended up rolling back to the old input and back to Unity 2019.1 due to several small touch-related problems (not only Pen) on random Android devices... got several complains from random players all touch-related and rolled back
     
  9. mvriel

    mvriel

    Joined:
    Mar 17, 2015
    Posts:
    13