Unity-Wiimote
Unity-Wiimote copied to clipboard
HIDAPI error on build
Testing the wiimote on editor runs as expected but on build it does not respond. Reading the output log shows: Incorrent Input to HIDAPI. No data has been sent.
This also occurs on the test scene provided. Has anyone been able to successfully use the wiimote on a built project?
Attempted on both Windows 10 and OSX Wiimote model RVL-CNT-01
Is the Unity editor open when you try to run the game? If so then close it.
Hey, I was getting the same error. With the editor closed.
Some more info from the log:
Couldn't open /Users/frank/Code/game/main_game/server.app/Contents/Plugins/hidapi.bundle/Contents/MacOS/hidapi, error: dlopen(/Users/frank/Code/game/main_game/server.app/Contents/Plugins/hidapi.bundle/Contents/MacOS/hidapi, 2): no suitable image found. Did find: /Users/frank/Code/game/main_game/server.app/Contents/Plugins/hidapi.bundle/Contents/MacOS/hidapi: mach-o, but wrong architecture
Hi, sorry for the late response - the editor is indeed closed. Revisiting this issue at Wiimote::SendWithType/2 it seems that res is 0 in editor, but -2 on build when finding wiimotes.
Hey Everyone,
Rebuilding the hidapi library from the source (found here https://github.com/signal11/hidapi) and using the produced dll to replace the hidapi.dll found in ...\Assets\Wiimote\Plugins\win32. It seems to work for me.
I FOUND IT. You guys need to CLEAN after you stop the game. If you don't do something like this:
void OnApplicationQuit() {
if (remote != null) {
WiimoteManager.Cleanup(remote);
remote = null;
}
}
}
you're going to be screwed next time you start up and have to literally use the power button of your wii remote to turn off and turn it back on.
If you somehow manage to stop the game and "WiimoteManager.Cleanup(remote);" did not run, you have to restart the wiimote. I'm currently looking for alternatives on how to make the wiimote work from that broken state without the need to turn off and turn on again.
Sorry, can someone upload the hidapi for windows 10?? I don't understand how to rebuild for this hidapi.
@jerry900287 Try my way. I didn't have to rebuild the HIDAPI at all, and I doubt that's the issue. It works for me, because I cleaned before closing.
@B0M Have you tried to build on desktop and run ? It is successful to run on unity but I build on desktop is fail. I have tried your way but it does not work. It still prints " Incorrent Input to HIDAPI. No data has been sent. " Do I misunderstand ?
I only just tried the wiimote on build and it worked identically, no problems so far on desktop build. when it said "Incorrect input to HIDAPI. No data has been sent.", did you try to hold the power button multiple times until the LED lights start flashing to fix the problem?
Also for the odd occasions when the wiimotes stop working, you want to detect and event like this, clean the remotes and refind it. The event i looked for was this
if (WiimoteManager.Wiimotes [i].ReadWiimoteData () < 0)
not sure if there exists a better way.
Thank God !!!! I solved it. The problem is my project's "Architecture" of build settings needs to set on x86_64, not to set on x86. Thank for your help !!!!
@jackoson Thank you very much :)