I am experiencing issues with the new input system. I managed to connect and use a USB joystick in the editor, and it works fine in the Windows build, but as soon as I build for Android, it stops working even though it is detected.
On Windows, it says “Microntek USB Joystick” and the input works.
On Android, it says “AndroidJoystick Microntek USB Joystick” but the input does not work.
This script is designed to detect the name of the joystick and verify if the input is functioning.
public class UniversalInputDetector : MonoBehaviour
{
public Text text;
public Text inputField;
void Update()
{
if (Joystick.all.Count > 0)
{
Joystick joystick = Joystick.all[0];
string activeInputs = "Active Inputs:\n";
text.text = $"Device: {joystick.name}";
foreach (InputControl control in joystick.allControls)
{
if (control is ButtonControl button && button.isPressed)
{
activeInputs += $"{control.name}: Pressed\n";
}
else if (control is AxisControl axis)
{
float value = axis.ReadValue();
if (Mathf.Abs(value) > 0.1f)
{
activeInputs += $"{control.name}: {value:F2}\n";
}
}
else
{
var value = control.ReadValueAsObject();
if (value != null && value.ToString() != "0")
{
activeInputs += $"{control.name}: {value}\n";
}
}
}
Debug.Log(activeInputs);
inputField.text = activeInputs;
}
else
{
Debug.Log("No joystick connected.");
text.text = "No joystick connected.";
}
}
}
Note : am using Unity 6 and input system version 1.11.2