InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

InputDebugger incorrectly shows data from remote Touchscreen

Open todi1856 opened this issue 8 years ago • 6 comments

  • Ran application on Android
  • Connected Input Debugger
  • Produced some touches

See touchscreenremotedebugger

The position value is very weird, printing position on Android itself shows other values, phase value doesn't change at all, that means InputDebugger incorrectly display received data. (Maybe because it sends Delta event?)

Also InputDebugger gets stuck for 2-8 seconds after receiving 20-30 events.

todi1856 avatar Mar 22 '18 13:03 todi1856

The position value is very weird, printing position on Android itself shows other values

That's to be expected and likely working as intended. Unfortunately, pointer positions are a tricky thing. If you do Pointer.current.position.value, which coordinate space do you expect things to be in? Given that the system also works in the editor (i.e. in EditorWindow code), this becomes a bit of a non-trivial affair.

What I've opted to do is have implicit coordinate space conversion. I.e. the position depends on which code is looking at it. If game code is looking at it, it's in the same space as Input.mousePosition. If editor code is looking at it (from an EditorWindow callback), it's in the window space of the current editor (which interestingly also has an inverted Y axis).

The upside is you don't have to perform coordinate space conversion every time you ask for the pointer position (which would become a bigger problem when used with actions) but the downside is the you get some non-intuitive results looking at the position in the debugger -- which is an EditorWindow and thus will display pointer coordinates in its own space.

If you activate "Lock Input to Game", the position will likely be what you expect it to be.

Rene-Damm avatar Mar 22 '18 19:03 Rene-Damm

phase value doesn't change at all, that means InputDebugger incorrectly display received data

Looking at the control tree, all the offsets for the first-level children are 0. So there's something wrong in the wiring there. Either the template is botched already on the Android side or the template or the device created from it is getting screwed up on the editor side.

Rene-Damm avatar Mar 22 '18 19:03 Rene-Damm

Also InputDebugger gets stuck for 2-8 seconds after receiving 20-30 events.

Could you break in the debugger and see what the code is doing?

Rene-Damm avatar Mar 22 '18 19:03 Rene-Damm

So you're saying touch position which is sent from Android to Editor, is being transformed, that's why InputDebugger shows it that way? I mean can't it detected that this is a remote input event and don't do anything?

todi1856 avatar Mar 22 '18 20:03 todi1856

So you're saying touch position which is sent from Android to Editor, is being transformed, that's why InputDebugger shows it that way?

Yes. InputControls can have processors attached to them which will process raw values as they are read out from memory. This is how deadzone processing is handled, for example. On Pointer.position there's an AutoWindowSpace processor attached.

Confusingly, due to some WIP, if you look at a state event, it shows you the raw, unprocessed values. But when you look at the device state in the main window, it shows you the final processed values. I'd like to have a switch for both views that determine which set of data you're interested (or maybe just display both?). This would also solve your problem.

However, it should mean that the data shown in the events themselves should be what you expect.

Rene-Damm avatar Mar 23 '18 18:03 Rene-Damm

I cannot repro this anymore on 0.2.0-preview with 2019.1.0b6.

JiaUnity avatar Mar 08 '19 22:03 JiaUnity