New Input System: Possible to prevent device from being recognized (or remove it completely)?

We are using a third-party USB device called a Phidget Interface Kit. They offer a C# library to communicate with it. We can talk to it if we set our Unity project to use the old Input Manager, but if we switch to the new Input System or use both, then we get a persistent Resource Busy error when attempting to connect to it. It can’t be connected to if it’s already in use by anything else.

We have tried calling RemoveDevice on it, but even once it has been removed, something inside Unity is holding a reference to it because we still get Resource Busy. We think this is what’s causing our problem: “Note that Devices are not destroyed when removed. Device instances remain valid and you can still access them in code. However, trying to read values from the controls of these Devices leads to exceptions.” We also tried calling FlushDisconnectedDevices after removing it but that didn’t help either.

We can’t find code samples on how to destroy a device once it’s been removed, or better yet how to never add it in the first place. Is there an intended hook to do this, and if so could you provide a sample of it?

One more try. Any help appreciated.

I’ve just found the same conflict myself using Unity 2021.3.15f1 and the New Input System v1.4.4. I also found another post about it from 2020: Conflict with Unity's New Input System - Phidgets Forums

Did you manage to find a solution / fix for this?

I’ve just checked this issue again, it is still present in Unity 2022.3.5f1 & Input System 1.6.3.

Is it possible for someone at Unity support to look into this issue and comment here? Many thanks.

Unfortunately, no, I don’t think that’s currently possible.

Last I checked, at least on Windows, Unity will invariably open all HIDs it can get its hands on. There’s means of suppressing them being turned into InputDevices but yeah, as you found, Unity will still hold on to the file descriptors for them and thus block others.

Would be great if this could be influenced from the managed side such that any HID that isn’t actively turned into an InputDevice (managed side) will also not be held on to from the native side. It’s slightly complicated by the fact that this is an async process and an InputDevice may appear for a HID at a much later point than its discovery. Ideally, the native side would not actively open a HID until after the managed side has established a connection (i.e. it would only report the device’s presence and open a channel and send events only once the device has been connected to an InputDevice). This would also help with the input system getting useless HID events for devices it’s not interested in.

Running into the same problem with unity 6 and the current version of the new input system. Did anyone manage to find a solution for this?

1 Like