Possible Bug: Unity 2021 + Phidget22 + 1047_1B High Speed Encoder
Posted: Tue Oct 11, 2022 1:06 pm
I built a proto-type game controller for Unity3D using PhidgetEncoder High Speed 4-Input model 1047_2B. After successfully prototyping I needed to build another controller, however, at the time I placed the follow-up order, 1047_2B was out of stock and only the older 1047_1B devices were available. Within my Unity application, attempts to open the 1047_1B device timeout with a message saying: open failed because device is in use. Deeper investigation shows that the process holding the device is the Unity Editor itself, it seems to grab the device immediately upon start up. When I plug in my original prototype built with the newer 1047_2B device, my Unity project works fine.
I am using Phidget22 1.12 with Unity versions 2021.3.[4f1, 7f1, and 11f1] all versions of Unity are affected. I have tried several older Phidget22 versions with the same results. I have tried the following with no success:
Also for further clarification, my project is based on the Unity example code (phidgets dot com/?view=articles&article=UsingPhidgetsWithUnity) which includes the recommended clean-up code:
I am using Phidget22 1.12 with Unity versions 2021.3.[4f1, 7f1, and 11f1] all versions of Unity are affected. I have tried several older Phidget22 versions with the same results. I have tried the following with no success:
- Rebooting machine
- Powering down, unplugging device, booting up, plugging device back in.
- Plugging in device after Unity starts
- Close Unity
- Open Phidget Control Panel
- Open Encoder Input 0
- Open Digital Input 0
- Open Unity project
- Close Phidget Control Panel (releasing phidget)
- Start Unity project in Editor
Also for further clarification, my project is based on the Unity example code (phidgets dot com/?view=articles&article=UsingPhidgetsWithUnity) which includes the recommended clean-up code:
Code: Select all
void OnApplicationQuit()
{
encoder.PositionChange -= OnPositionChange;
encoder.Close();
encoder = null;
if (Application.isEditor)
Phidget.ResetLibrary();
else
Phidget.FinalizeLibrary(0);
}