diff --git a/Assets/Scripts/WiimoteDemo.cs b/Assets/Scripts/WiimoteDemo.cs index c05329d..1f9025a 100644 --- a/Assets/Scripts/WiimoteDemo.cs +++ b/Assets/Scripts/WiimoteDemo.cs @@ -106,8 +106,10 @@ void OnGUI() wiimote = null; } - if (wiimote == null) + if (wiimote == null) { + GUILayout.EndVertical(); return; + } GUILayout.Label("Extension: " + wiimote.current_ext.ToString()); diff --git a/Assets/Wiimote/Scripts/WiimoteManager.cs b/Assets/Wiimote/Scripts/WiimoteManager.cs index ca337f6..faa876b 100644 --- a/Assets/Wiimote/Scripts/WiimoteManager.cs +++ b/Assets/Wiimote/Scripts/WiimoteManager.cs @@ -59,8 +59,12 @@ private static bool _FindWiimotes(WiimoteType type) IntPtr ptr = HIDapi.hid_enumerate(vendor, product); IntPtr cur_ptr = ptr; - if (ptr == IntPtr.Zero) + if (ptr == IntPtr.Zero) { + HIDapi.hid_free_enumeration(ptr); + Debug.Log("No Wiimotes found!"); return false; + } + hid_device_info enumerate = (hid_device_info)Marshal.PtrToStructure(ptr, typeof(hid_device_info)); @@ -84,6 +88,8 @@ private static bool _FindWiimotes(WiimoteType type) if (remote == null) { IntPtr handle = HIDapi.hid_open_path(enumerate.path); + if (handle == IntPtr.Zero) + Debug.LogError("Failed to open HID device."); //Possinbly a permissions issue on Linux WiimoteType trueType = type; diff --git a/README.md b/README.md index 38b6905..a9e0424 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ The latest release can be found [here](http://www.github.com/Flafla2/Unity-Wiimo To install, open Unity-Wiimote.unitypackage or go to Assets->Import Package->Custom Package... in the Unity Editor and locate Unity-Wiimote.unitypackage. +If using Linux, sudo permissions may be required. + Future Changes --------------