Detecting type of joystick/controller for player 1

I was a little confused on how to properly detect the type of controller that is plugged in for each player. Particularly player 1.

I feel like there would be conflicts mapping controller inputs due to the different axis that each controller uses.

For example,

A playstation controllers axis would be different than an xbox controller. Within my code, if i were to code for the xbox controller and configure all of the axis/buttons, it seems like there would be overlapping but different axis for the playstation controller.

I could be thinking about this completely wrong but it seems like you would have to distinguish which type of joystick is being used and use a conditional statement within the code for the controls.

I appreciate any sort of help. Thanks in advance.

When it comes to controlls it’s best to use the Input manager to avoid hard coding each of the buttons and for different devices.

However there have been problems with unity when it comes to xbox controllers such as joysticks control multiple players at random. There is a plugin you can download called XInputDotNet that can help you manage each players controller.