I'll definitely need to look into it in the future. What caught me was that I was trying to use a conditional to switch how a variable was used depending on if you had a gamepad connected or not. I tried using the Input.GetJoystickNames but lost time trying to get that to work reliably. So my next step was to use a different solution. I started cutting out code until I got to a functional minimum.
This is what I ended up with:
if(Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0) { tiltAroundY += Input.GetAxis("Mouse Y") + Input.GetAxis("Mouse X"); } else { tiltAroundY += Input.GetAxis("Mouse Y2") + Input.GetAxis("Mouse X2"); }
So if you're using a gamepad, Mouse X and Mouse Y will correspond to the Right Analog stick on the gamepad and allow you to rotate the camera. If you don't have a gamepad, Mouse X and Mouse Y will always be 0, and so therefore the else conditional will run, using the next axis which will work with your mouse.