From 23876c27d24ec220b87cff58adee812567b43111 Mon Sep 17 00:00:00 2001 From: ggmini Date: Wed, 24 Jun 2026 16:24:27 +0200 Subject: [PATCH 1/3] fix: fixed GUI Errors when no wiimote connected --- Assets/Scripts/WiimoteDemo.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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()); From a69d50e328ee93f38fd0b332fff303f9d92a5d79 Mon Sep 17 00:00:00 2001 From: ggmini Date: Wed, 24 Jun 2026 16:25:29 +0200 Subject: [PATCH 2/3] added some error message & comments --- Assets/Wiimote/Scripts/WiimoteManager.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; From 1efa6da1403170b9ece49235e27ae3f72f8a92c2 Mon Sep 17 00:00:00 2001 From: ggmini Date: Wed, 24 Jun 2026 16:26:21 +0200 Subject: [PATCH 3/3] docs: added linux sudo requirement to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) 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 --------------