InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

Mouse no longer detected

Open jonasmora opened this issue 8 years ago • 10 comments

I recently updated the input system plugin to the latest code on the develop branch.

Updating 6163470..63e2d4b

Now the mouse is no longer detected, Mouse.current is always null.

Is this the intended behavior and I need to do something else?

My code looks something like this (the code worked before updating):

    InputActionMap inputActionMap;
    void Awake() {
        inputActionMap = new InputActionMap("gameplay");
        if (Mouse.current != null) {
            inputActionMap.AddAction("mouseLeftButton", "/<mouse>/leftButton").performed += ctx => {
            }
        }
    }
    public void OnEnable() {
        inputActionMap.Enable();
    }
    public void OnDisable() {
        inputActionMap.Disable();
    }

I tried moving the code from the Awake to Start, Update and InputSystem.onDeviceChange but the result is the same.

jonasmora avatar Aug 28 '18 22:08 jonasmora

Things are a little unstable on the develop branch ATM as I'm trying to push some more painful refactors through. Looks like you've hit a case where it now fails to either match a device entirely or (more likely) has lost the device across a domain reload. I'll take a look. So far, doesn't seem like it's the only problem with the refactored domain reload and system startup.

Reverting to 503fa708d213208794e752ab4b8948db13a4744f is likely going to get rid of the problem for now.

Rene-Damm avatar Aug 28 '18 22:08 Rene-Damm

In the input debugger, is the mouse still there?

Rene-Damm avatar Aug 28 '18 22:08 Rene-Damm

I forgot to mention I also updated from Unity 2018.2.4f1 to 2018.2.5f1.

The mouse issue is using the editor on Mac.

The touchscreen works fine running on Android (Touchscreen.current != null is true).

I didn’t know about the input debugger, where can I find that?

jonasmora avatar Aug 28 '18 23:08 jonasmora

In the editor main menu under "Window >> Input Debugger". When you connect to a player (either manually through the profiler window or by enabling "Auto Connect To Profiler" in build window), the debugger should also connect to player and show all devices from players as well as their events. Still have to verify though that I haven't regressed that part with my recent changes.

Rene-Damm avatar Aug 28 '18 23:08 Rene-Damm

In the Input Debugger the Mouse is listed under "Devices (1)"

With Diagnostics enabled I get a bunch of:

Cannot find device for input event: id=259948 type=DLTA device=7 size=784 time=47.0352220535278

jonasmora avatar Aug 29 '18 13:08 jonasmora

Reverting to 503fa70 makes things worse, the Mouse is not even listed under Devices.

jonasmora avatar Aug 29 '18 13:08 jonasmora

This seems to be working now.

jonasmora avatar Sep 04 '18 15:09 jonasmora

Seems to be broken in 2018.3.0b3. Touchscreen also returns null. Is there any was to have Mouse.current.leftButton.wasJustPressed or isPressed as a delegate?

OfficialKris avatar Sep 29 '18 13:09 OfficialKris

Don't think this repro on 0.2.0-preview.

JiaUnity avatar Mar 05 '19 03:03 JiaUnity

This should be fixed. Close.

JiaUnity avatar Mar 05 '19 03:03 JiaUnity