Mouse no longer detected
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.
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.
In the input debugger, is the mouse still there?
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?
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.
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
Reverting to 503fa70 makes things worse, the Mouse is not even listed under Devices.
This seems to be working now.
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?
Don't think this repro on 0.2.0-preview.
This should be fixed. Close.