Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Assets/Scripts/WiimoteDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ void OnGUI()
wiimote = null;
}

if (wiimote == null)
if (wiimote == null) {
GUILayout.EndVertical();
return;
}

GUILayout.Label("Extension: " + wiimote.current_ext.ToString());

Expand Down
8 changes: 7 additions & 1 deletion Assets/Wiimote/Scripts/WiimoteManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------

Expand Down