#How do I find if an InputDevice is a gamepad?
1 messages · Page 1 of 1 (latest)
What you have almost is working code: cs foreach(var device in plrInput.devices) { if(device is Gamepad gp) { return gp; } } return null;
1 messages · Page 1 of 1 (latest)
Here's my pseudocode
Gamepad GetGamepad()
{
foreach (InputDevice device in plrInput.devices)
{
if (device /*is a gamepad*/)
{
return /* the gamepad */
}
}
return null;
}```
What you have almost is working code: cs foreach(var device in plrInput.devices) { if(device is Gamepad gp) { return gp; } } return null;