Hey Unity team,
I already liked to use the new input system, but once I decided to try sensors with iOS I faced some issues:
When I enable and read values from Gyroscope.current, it seems fine. However, when I attempt to enable AttitudeSensor, I already face problems. I double checked:
https://docs.unity3d.com/Packages/com.unity.inputsystem@0.9/manual/Sensors.html
but I also checked Apple’s iPhone XR page, where it is written that it has no such a sensor. But I wonder how Input.gyro.attitude works fine then? Look here:
//# if UNITY_IOS
using Gyroscope = UnityEngine.InputSystem.Gyroscope;
//#endif
/* ... */
// it works fine
var gyroscope = Gyroscope.current;
if (gyroscope != null)
{
InputSystem.EnableDevice(gyroscope);
Debug.Log(gyroscope.enabled ? "Gyroscope is enabled" : "Gyroscope is NOT enabled");
}
// it doesn't work at all – because attitude is null ... I checked it later with else after that block
var attitude = AttitudeSensor.current;
if (attitude != null)
{
InputSystem.EnableDevice(attitude);
Debug.Log(attitude.enabled ? "AttitudeSensor is enabled" : "AttitudeSensor is NOT enabled");
}