- Home /
new Input System iOS Attitude
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: https://docs.unity3d.com/2017.1/Documentation/ScriptReference/Gyroscope.html
//# 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");
}
Answer by latamakuchi · 4 days ago
I had a similar issue earlier where the AttitudeSensor would do absolutely nothing on iOS. Fixed it by going to Edit > Project Settings > Input System Package, creating a settings asset with the button there, then checking the Motion Usage box for iOS and filling in a description.