Search Unity

Determining if a Gamepad is Connected

Discussion in 'Input System' started by roryo, Nov 23, 2019.

  1. roryo

    roryo

    Joined:
    May 21, 2009
    Posts:
    1,479
    I got started with the new input system a few weeks ago and am loving it!

    Question: Is there a way to determine if a gamepad is connected to the PC with the new input system?

    I am building an onboarding hint system for a game. It would be great to have the hints customized to suit the input devices available. For example, if there is no gamepad connected to the PC, then there is no need to show gamepad hints.

    Thanks for any help.
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Code (CSharp):
    1. Gamepad.all.Count > 0
    Would generally recommend doing this by actively used control scheme. I.e. have one control scheme for kb&mouse and one for gamepad and then show hints depending on which ones is currently active.
     
    vama89 likes this.