Controllers not properly sending inputs to the game, sometimes sending phantom inputs
Hey there. My friend and I have been working on a game for a while now. We've recently found that when two controllers are plugged into the PC at once, the controllers no longer properly send inputs to the game (or at least that's what seems to be happening?) The issue can be seen here -https://streamable.com/8dadm - as I've got 2 controllers plugged in. This doesn't happen at all with a single controller plugged in. I've triple checked my input manager. Here's the code we have for the camera rotation: (not sure how to ensure that the code block properly appears, here's hoping it does haha)
public void Update()
{
rotAroundX += Input.GetAxis("Mouse Y") * player.Xsensitivity;
rotAroundY += Input.GetAxis("Mouse X") * player.Ysensitivity;
rotAroundX += Input.GetAxis("Joy" + player.playerID + "Axis5") * -player.Xsensitivity;
rotAroundY += Input.GetAxis("Joy" + player.playerID + "Axis4") * player.Ysensitivity;
// Clamp rotation values
rotAroundX = Mathf.Clamp(rotAroundX, player.XMinRotation, player.XMaxRotation);
CameraRotation();
}
private void CameraRotation()
{
player.target.transform.rotation = Quaternion.Euler(-rotAroundX, rotAroundY, 0);
cam.transform.rotation = Quaternion.Slerp(cam.transform.rotation, player.target.transform.rotation, player.slerpAmount);
}
public void LateUpdate()
{
Vector3 targetPos = player.target.position + (player.transform.forward * player.offset);
Vector3 smoothPos = Vector3.Lerp(player.transform.position, targetPos, player.smoothSpeed * Time.deltaTime);
player.transform.position = smoothPos;
}
Obviously the method of moving one object before the camera is a bit strange, but it works well for our needs.
It's a really nerve-wracking issue as there seems to be no real source of the problem. We were using Rewired a while ago but got rid of it since we weren't using it, and thought it might be the source of the issue, but it made no difference. We also thought it might have been my own computer, so we tried it on 3 more and the issue persisted. We then tested several different controllers, and it was still there. I actually even imported all of the Assets from the project into a new project and hooked up the character controllers we had to fresh new characters and the issue was still there. We've tried putting the inputs in the FixedUpdate and LateUpdate, but it made no difference. The weirdest thing is that the issue will sometimes come and go. For instance, we'll have short playable moments of the game where the controllers will work but then inevitably stop. Any help would be greatly appreciated! I've hit a brick wall, and so has my pal.