title: How to update gps in unity?
body: <p>I am currently working on ar game through Unity. I am making the game using Vuforia sdk.
  GPS coordinates are required within the game, but gps coordinates are not updated. 
  The strange thing is that in a single application that uses gps code only to display coordinates on the screen, gps coordinates are updated correctly, but if I put the same code into the game, the gps coordinates are no longer updated at the beginning of the application.
  I don't think that's a problem with code. Please help.</p>
  
  <p>public class GPSCheck : MonoBehaviour{</p>
  
  <pre><code>public static double first_Lat;
  public static double first_Long;
  public static double current_Lat;
  public static double current_Long; 
  
  private static WaitForSeconds second;
  
  private static bool gpsStarted = false;
  
  private static LocationInfo location;
  
  private void Awake()
  {
      second = new WaitForSeconds(1.0f);
  }
  
  IEnumerator Start()
  {
  
      if (!Input.location.isEnabledByUser)
      {
          Debug.Log("GPS is not enabled");
          yield break;
      }
  
  
      Input.location.Start(5f, 10f);
      Debug.Log("Awaiting initialization");
  
  
      int maxWait = 20;
      while (Input.location.status == LocationServiceStatus.Initializing &amp;&amp; maxWait &gt; 0)
      {
          yield return second;
          maxWait -= 1;
      }
  
      if (maxWait &lt; 1)
      {
          Debug.Log("Timed out");
          yield break;
      }
  
  
      if (Input.location.status == LocationServiceStatus.Failed)
      {
          Debug.Log("Unable to determine device location");
          yield break;
  
      }
      else
      {
  
          location = Input.location.lastData;
          first_Lat = location.latitude * 1.0d;
          first_Long = location.longitude * 1.0d;
          gpsStarted = true;
  
  
          while (gpsStarted)
          {
              location = Input.location.lastData;
              current_Lat = location.latitude * 1.0d;
              current_Long = location.longitude * 1.0d;
              yield return second;
          }
      }
  }
  
  public static void StopGPS()
  {
      if (Input.location.isEnabledByUser)
      {
          gpsStarted = false;
          Input.location.Stop();
      }
  }
  </code></pre>
  
  <p>}</p>