Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Keep getting errors when trying to implement UI values in my AR project. I have added the XR extenstion but I cant get it going

$
0
0
I want to know if I need to add GPS location to my AR project another way http://assets/GPSLocation.cs(70,68):%20error%20CS1061:%20'LocationInfo'%20does%20not%20contain%20a%20definition%20for%20'horizonalAccuracy'%20and%20no%20accessible%20extension%20method%20'horizonalAccuracy'%20accepting%20a%20first%20argument%20of%20type%20'LocationInfo'%20could%20be%20found%20(are%20you%20missing%20a%20using%20directive%20or%20an%20assembly%20reference?) https://www.google.com/search?q=Assets%5CGPSLocation.cs(63%2C38)%3A+error+CS0103%3A+The+name+%27LocationServicesStatus%27+does+not+exist+in+the+current+context&rlz=1C1CHBF_enNZ924NZ924&oq=Assets%5CGPSLocation.cs(63%2C38)%3A+error+CS0103%3A+The+name+%27LocationServicesStatus%27+does+not+exist+in+the+current+context&aqs=chrome..69i57j69i58.807j0j15&sourceid=chrome&ie=UTF-8 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR.ARFoundation; using UnityEngine.XR.ARSubsystems; using UnityEngine.UI; public class GPSLocation : MonoBehaviour { public Text GPSStatus; public Text latitudeValue; public Text longitudeValue; public Text altitudeValue; public Text horizontalAccuracyValue; public Text timestampValue; // Start is called before the first frame update void Start() //Calling the GPS log - this is called only once { StartCoroutine(GPSLoc()); } IEnumerator GPSLoc() { //Checks if the user has location service enabled on their device if (!Input.location.isEnabledByUser) yield break; //Start service before querying the users location Input.location.Start(); //Wait until location service is initialized (maximum wait 20seconds). int maxWait = 20; while(Input.location.status == GPSLocationServicesStatus.Initializing && maxWait > 0) { yield return new WaitForSeconds(1); maxWait--; } //Service didn't initiatie in 20 seconds if (maxWait < 1) { GPSStatus.text = "Time out"; yield break; } // Connection to location services has failed if (Input.location.status == LocationServiceStatus.Failed) { GPSStatus.text = "Unable to determine device location"; yield break; } else { //Access has been granted GPSStatus.text = "Running"; InvokeRepeating("UpdatingGPSData", 0.5f, 1f); } }//End of GPSLoc private void UpdateGPSData() { if (Input.location.status == LocationServicesStatus.Running) { //Access granted to the GPS values and it has been initialized GPSStatus.text = "Running"; latitudeValue.text = Input.location.lastData.latitude.ToString(); longitudeValue.text = Input.location.lastData.longitude.ToString(); altitudeValue.text = Input.location.lastData.altitude.ToString(); horizontalAccuracyValue.text = Input.location.lastData.horizonalAccuracy.ToString(); timestampValue.text = Input.location.lastData.timestamp.ToString(); } else { //The service is stopped GPSStatus.text = "GPS disabled"; } }//End of the UpdateGPSData } //End of the GPSLocation

Viewing all articles
Browse latest Browse all 2891

Trending Articles