I’m working on a quick top-down character controller, and I want to detect whether my current control scheme being used is either the gamepad or the keyboard. My issue is that Unity seems to default and only ever detect gamepad, even when I’ve unplugged/detached any gamepad controller and strictly using a keyboard and mouse.
The main way im trying to detect this for my main movement script is by having a function called on the ‘Controls Changed Event’ in the Player Input Component
It only ever fires as true, and in practice it only runs once on startup and never again.
public void OnDeviceChanged(PlayerInput playInput)
{
isGamepadActive = playInput.currentControlScheme.Equals("GamePad") ? true : false;
Debug.Log(isGamepadActive);
}
I’m having a hard time seeing if anyone else has a similar issue, and I’m suspecting it might be how unity is detecting/using the current control scheme.
I hope someone has a fix, and I appreciate your time!
DSCO_dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.