Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class gpslocation1 : MonoBehaviour
- {
- public float Latitude;
- public float Longitude;
- private void Start()
- {
- if (Input.location.isEnabledByUser)
- StartCoroutine(GetLocation());
- }
- private IEnumerator GetLocation()
- {
- Input.location.Start();
- while (Input.location.status == LocationServiceStatus.Initializing)
- {
- yield return new WaitForSeconds(0.5f);
- }
- while (Input.location.status == LocationServiceStatus.Running)
- {
- Latitude = Input.location.lastData.latitude;
- Longitude = Input.location.lastData.longitude;
- yield return null;
- }
- yield return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement