Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Following the DirectInput example but joystickGUID stays empty #38

Open
Schroedingers-Cat opened this issue May 6, 2016 · 0 comments
Open

Comments

@Schroedingers-Cat
Copy link

Schroedingers-Cat commented May 6, 2016

I've been following this script example: https://github.com/sharpdx/SharpDX-Samples/blob/master/Desktop/DirectInput/JoystickApp/Program.cs

I'm using SharpDX 2.6.3 for .NET 2.0 with Unity 5.3 on Windows 10. I had to copy the System.Windows.Forms.dll from mono 2.0 next to the SharpDX files for Unity to work with SharpDX.

I have two "Wireless Controllers" (DualShock 4 from the PS4, which is a DirectInput Controller) connected to Windows, one via bluetooth and one via usb. Both show up at the windows gamecontroller setup window and all their axes and buttons work.
However, when my script calls this line

foreach (var deviceInstance in directInput.GetDevices(SharpDX.DirectInput.DeviceType.Gamepad, DeviceEnumerationFlags.AllDevices))
  joystickGuid = deviceInstance.InstanceGuid;

or this line

if (joystickGuid == Guid.Empty)
  foreach (var deviceInstance in directInput.GetDevices(SharpDX.DirectInput.DeviceType.Joystick, DeviceEnumerationFlags.AllDevices))
    joystickGuid = deviceInstance.InstanceGuid;

then I can see in MonoDevelops debugger that joystickGuid is still empty as it only holds one {00000000-0000-0000-0000-000000000000}.

What could be the problem?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant