Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Hang the script on the Text object and see the values of the compass axes.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class test : MonoBehaviour {
public Vector3 xyz;
private Text textlabel;
// Use this for initialization
void Start () {
textlabel = gameObject.GetComponent<Text>();
Input.compass.enabled = true;
}
// Update is called once per frame
void Update () {
xyz = Input.compass.rawVector;
textlabel.text = string.Format ("x={0}:y={1}:z={2}:enabled={3}",xyz.x,xyz.y,xyz.z,Input.compass.enabled);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question