Search Unity

Detecting buttons present on Gamepad

Discussion in 'Input System' started by bryangale, Aug 12, 2020.

  1. bryangale

    bryangale

    Joined:
    Dec 13, 2014
    Posts:
    5
    Going by this in the documentation:

    A Gamepad is narrowly defined as a Device with two thumbsticks, a D-pad, and four face buttons. Additionally, gamepads usually have two shoulder and two trigger buttons. Most gamepads also have two buttons in the middle.

    (https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Gamepad.html)
    it's possible for a controller represented as a Gamepad to not have shoulder/trigger buttons. If this is the case (maybe for some MFi devices?), is it possible to detect if a Gamepad actually has shoulder/trigger buttons or not? What happens if we try to access Gamepad.current.leftShoulder on a controller that doesn't have shoulder buttons, for instance?