Seeing as we are making a spaceship type game I have attached a sophisticated flight controller joystick to my computer.
First of all there in no easy way to map joystick buttons CrossPlatformInputManager as it doesn’t have a learning mode, secondly there is no method to get an array of pressed buttons or anyway of passing in a generic string such as “joystick button 0” for example.
Ideally what is needed is for the player to be able to configure there own button and axes.
bool f = CrossPlatformInputManager.GetButton("Trigger");
if (f)
{
print("Firing!!!");
}
if(f != Firing)
{
Firing = f;
}
Secondly i tried interrogating the unity engine at a low level. This doesn’t work either as no Joysticks are returned, although the joystick might be masquerading as a gamepad.
UnityEngine.InputSystem.Joystick js = null;
foreach (UnityEngine.InputSystem.Joystick jst in UnityEngine.InputSystem.Joystick.all)
{
js = jst;
break;
}
if(js==null)
{
return;
}