- Home /
Why is compass.enabled always false?
I'm trying to create an arrow that would point to the north. However, my compass in unity is always disabled even after some time has passed. Here is the code: public class ArrowMarker : MonoBehaviour { public Transform target; private float northDir;
private void Start()
{
Input.compass.enabled = true;
Input.location.Start();
}
void Update()
{
Input.compass.enabled = true;
northDir = Input.compass.magneticHeading;
target.rotation = Quaternion.Euler(0, northDir, 0);
Debug.Log("compass: " + northDir);
Debug.Log("enabled : " + Input.compass.enabled);
}
},I'm trying to create an arrow that would always point to the north, however, the compass in unity is always disabled even after it's supposed to "warm up". Here is the code: public class ArrowMarker : MonoBehaviour { public Transform target; private float northDir;
private void Start()
{
Input.compass.enabled = true;
Input.location.Start();
}
void Update()
{
Input.compass.enabled = true;
northDir = Input.compass.magneticHeading;
target.rotation = Quaternion.Euler(0, northDir, 0);
Debug.Log("compass: " + northDir);
Debug.Log("enabled : " + Input.compass.enabled);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613025011im_/https://answers.unity.com/themes/thub/images/avi.jpg)