How does Unity's GPS work?

i am fairly new at unity and i wanted to research on its gps functionality. i have looked for a lot of answers and comments about it but nothing that is at a beginner’s level. the documentations were not that clear to me either. i tried the sample code in
http://docs.unity3d.com/Documentation/ScriptReference/LocationService.Start.html
but i got a couple of errors mostly saying: “An object of a type convertible to `bool’ is required for the return statement”

am i missing something? thanks!

Seems that in c# code the “yield break” has been missed after conversion.

javascript → “return”
c#  → “yield break”

I’ll submit a bug report for this.

By the way, this is the right code :

using UnityEngine;
using System.Collections;

public class TestLocationService : MonoBehaviour {
	IEnumerator Start() {
		if (!Input.location.isEnabledByUser)
			yield break;
		
		Input.location.Start();
		int maxWait = 20;
		while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) {
			yield return new WaitForSeconds(1);
			maxWait--;
		}
		if (maxWait < 1) {
			print("Timed out");
			yield break;
		}
		if (Input.location.status == LocationServiceStatus.Failed) {
			print("Unable to determine device location");
			yield break;
		} else
			print("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp);
		Input.location.Stop();
	}
}