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

Following the DirectInput example but joystickGUID stays empty #38

@Schroedingers-Cat

Description

@Schroedingers-Cat

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions