Im trying to get touches from Android but somehow because of it all GUIText objects stops updating unless touching the screen. Ive been tracking the problem to this line => touchPos = Input.GetTouch(0).position;
void Update () {
realStatus.text = Input.location.status.ToString();
LocationServiceStatus locationStatus = Input.location.status;
if (isTouchDevice) {
clickDetected = ((Input.touchCount > 0) && (Input.GetTouch(0).phase == TouchPhase.Began));
touchPos = Input.GetTouch(0).position;
touchCount.text = Input.touchCount.ToString();
} else {
clickDetected = Input.GetMouseButtonDown(0);
touchPos = Input.mousePosition;
}
if (clickDetected) {
// SOMECODE
}
isRunning.text = (locationStatus == LocationServiceStatus.Running).ToString();
if (locationStatus == LocationServiceStatus.Running) {
placeInfo.text = "Location: " + Input.location.lastData.latitude + "
" +
"Longitude: " + Input.location.lastData.longitude + "
" +
"Altitude: " + Input.location.lastData.altitude + "
" +
"Accuracy: " + Input.location.lastData.horizontalAccuracy + "
" +
"Time: " + Input.location.lastData.timestamp;
lastUpdate.text = "ONLINE TIME: " + Time.time.ToString();
} else if (locationStatus == LocationServiceStatus.Stopped) {
placeInfo.text = "GPS is Stopped!";
lastUpdate.text = "OFFLINE TIME: " + Time.time.ToString();
}
lastUpdate.text = "OFFLINE TIME: " + Time.time.ToString(); // TESTING
}
Can anyone figure out what Im doing wrong here?
Thanks!