GUI label appears in editor but not in build mode on device?
Hi I am fairly new to Unity so sorry if this is a silly question.
I am working with Unity 5.4 and havign an issue getting GUI Labels to display to the user. They will display in editor but not in build mode on the device (they will display when the device is used as a remote). I am confused because I am using GUI buttons and they show up fine and I have tried putting GUI Labels in other places in my code and they have worked in build mode too. Can you please tell me why the following GUI.Label(new rect(...)"Location found") may not be appearing in build mode? I call this code from OnGUI()
Thanks!!
IEnumerator editlocationgps()
{
Debug.Log("Entered ienumerator editlocatiogpsfunction");
// First, check if user has location service enabled
if (!Input.location.isEnabledByUser)
yield break;
// Start service before querying location
Input.location.Start();
// Wait until service initializes
int maxWait = 20;
while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
{
yield return new WaitForSeconds(1);
maxWait--;
}
// Service didn't initialize in 20 seconds
if (maxWait < 1)
{
print("Timed out");
yield break;
}
// Connection has failed
if (Input.location.status == LocationServiceStatus.Failed)
{
print("Unable to determine device location");
yield break;
}
else
{
// Access granted and location value could be retrieved
Debug.Log("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp);
GUI.Label(new Rect(200, 200, 200, 50),"Location found" );
}
// Stop service if there is no need to query location updates continuously
Input.location.Stop();
}
Comment