Search Unity

Question Controller Family

Discussion in 'Input System' started by xXApOXx, Jan 11, 2023.

  1. xXApOXx

    xXApOXx

    Joined:
    Feb 9, 2015
    Posts:
    76
    Hi,

    I'm new with the input system and I wish to know the type of my controller in order to draw the proper inputs in my UI between Sony, Xbox & Switch controllers.

    I found that an InputDevice contains a description but for my XboxSeries controller, it's mostly empty when playing in editor. Then I checked the layout string variable and it returns "XInputControllerWindows" but an XboxOne controller returns also the same result so I can't distinguish them if I need to.
    I have not tested the behavior in an build but I think the layout would be different with both of those controllers since the layout contains "Windows" in it.

    So I wonder what is the proper way to retrieve a controller family?
     
  2. xXApOXx

    xXApOXx

    Joined:
    Feb 9, 2015
    Posts:
    76
    I found my answer: you just need to use the current device type and iterate through its baseType to know its family.
    Also with XInput activated, it seems impossible to distinguish an XboxOne and an XboxSeriesX gamepad.