"Device is DISABLED" for mouse every time a game starts?

I’m using the new input system with Unity 2020.3.3f1 , and the mouse isn’t working.
When looking at the input debugger, then mouse screen, there is a message there:

“Device is DISABLED. Control value will not receive updates. To force-enable this device, you can right-click it in the input debugger and use ‘Enable Device’”.

While the force-enable works, the mouse will be disabled again when I restart the game.
How do i fix it? why is it even happening?

I have the same issue. No click action bindings are triggered (want to bind “Back” action on the right mouse click), but the InputSystemUIInputModule seems to work and UI gets clicks. “Enable device” doesn’t work for me. Removing the InputSystemUIInputModule didn’t help too.

I’m using Unity 2020.2.7f with Input System package 1.1.0-preview.3.
I don’t use PlayerInput component, I create my own IInputActionCollection instance, generated from the editor.
I’m sure the action is enabled, as the keyboard and gamepad bindings work fine.

Reported this to Unity via the “Report a bug” form.

1 Like

I’ve found out why this happens.
I had “Simulate Touch Input From Mouse or Pen” enabled which suppressed mouse events. Turning it off fixed it for me. Check yours in the “Input Debug” window, “Options” button.

5 Likes

Didn’t help in my case, I’m afraid. Whenever I switch into playmode the mouse gets disabled again. But even when I pause playmode, enable the mouse device and unpause no input is detected or recorded.

Did anyone ever find a solution for this? Without mouse input, my game is broken. :frowning:

I see in your other post that you tried a lot of stuff and it didn’t work. I guess you’ll have to strap on and dive in with the debugger. :smile: If I were you, I’d put break point on all the places InputDevice.m_DeviceFlags changes. With some patience you should get to the culprit.

Thanks. Sounds like I borked this up somewhere. Not sure how to debug this with Playmaker though. Wish me luck. :stuck_out_tongue:

1 Like

How would I do that?

Uhm… not sure what you’re asking and what is your background. So here it goes…

If you’re asking what to look for, it’s hard to say:

Looking at the InputDevice.enabled code it returns false when m_DeviceFlags has flags “DeviceFlags.DisabledInRuntime”, “DeviceFlags.DisabledInFrontend”, “DeviceFlags.DisabledWhileInBackground”, etc…

        public bool enabled
        {
            get
            {
                #if UNITY_EDITOR
                if (InputState.currentUpdateType == InputUpdateType.Editor && (m_DeviceFlags & DeviceFlags.DisabledWhileInBackground) != 0)
                    return true;
                #endif

                if ((m_DeviceFlags & (DeviceFlags.DisabledInFrontend | DeviceFlags.DisabledWhileInBackground)) != 0)
                    return false;

                return QueryEnabledStateFromRuntime();
            }
        }

So you need to find who is setting those, which indeed can be hard as this code is very deep.

If you’re asking how to do debugging in general:

How to debug with Visual Studio - https://www.youtube.com/watch?v=d0815qbx3BA (random tutorial on the internet).
What you need is the “Call Stack” panel at the bottom right.
So, in VS go to the “PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Devices\InputDevice.cs” file and put a break point (F9) on every line the m_DeviceFlags is set.

Attach the debugger and run the game and keep resuming till you get who is setting it with disable flags. Check with the call stack to trace back the culprit.

If your break points don’t work and you don’t see the Unity.InputSystem project in Visual Studio like so:
7793070--984183--upload_2022-1-9_14-16-16.png

You need to enable generating of such projects in the preferences. Go to Edit/Preferences/External Tools and enable “Embedded packages”, “Local packages”, “Registry packages”, “Built-in packages” (one of those should be it).
7793070--984186--upload_2022-1-9_14-18-45.png

Restart Unity, make sure it rebuilds the projects (reimport some .cs file).

I can’t help you much more without actually having the project right in front of me. :frowning:

Wow, thank you for this very detailed response. I will definitely use that at a later point. I was able to fix the issue by deleting the existing Event System and creating a new Empty GameObject with Input System components, which automatically added a new Event System component. This seems to have fixed the missing mouse input (at least for now).
Thanks again for your help. It is much appreciated.

1 Like

btw I resolved the issue by deleting the existing Event System and creating an empty GO and adding an Input System component to that. The Event System component was added automatically to the empty GO and everything was working fine afterwards.
Now for my new nemesis: Touch controls. :smile:

1 Like

if you add simulator tab, the mouse is disabled by default (tested at 2021,2.18f1)…and yeah i dont read change list…its huuuge.

4 Likes

You can force Mouse to be enabled (for example while playing in Editor with the Simulator open) as follows:

if (!Mouse.current.enabled) {
InputSystem.EnableDevice(Mouse.current);
}
3 Likes