InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

XInputController.current returns a Gamepad. Should it return a XInputController?

Open jackpr-unity opened this issue 8 years ago • 5 comments

jackpr-unity avatar Feb 16 '18 22:02 jackpr-unity

Yeah, think XInputController should probably implement its own .current getter.

Rene-Damm avatar Feb 16 '18 22:02 Rene-Damm

capture

It seems that you can get the current gamepad, but you have to check manually whether or not it is an XInput device? This enables our paradigm of writing input code against an abstracted interface, but does it make writing device specific code more difficult?

jackpr-unity avatar Feb 16 '18 22:02 jackpr-unity

Not sure what you mean. The static getter here is defined in Gamepad. Writing 'XInputController.current' will simply do the same as 'Gamepad.current' which is why the refactor is suggested. Not sure every device class should have its own getter (for DualShockGamepadHID, for example, it doesn't make sense IMO) but for XInputController, it seems to make sense to add its own static getter.

Rene-Damm avatar Feb 16 '18 22:02 Rene-Damm

I mean writing code against Gamepad is "better" in most instances, but writing against XInputController may be necessary for people wanting to target certain specific XInput device capabilities.

jackpr-unity avatar Feb 17 '18 01:02 jackpr-unity

@jackpr-unity take a look at my PR https://github.com/Unity-Technologies/InputSystem/pull/416 will this help you with this problem at all?

douglas-piconi avatar Feb 14 '19 19:02 douglas-piconi