- Home /
How to test Input.location with Unity Remote?
Hi, I'm trying to test GPS features of my game with unity remote. After the connection between the editor and my phone is correctly established, I start the location service (Input.location.Start() and then I use the code provided by the doc to wait for the initialisation to happen.
However, istead of staying in that loop, it exits right away with a location.status set to "Stopped" instead of "Initializing"
Is that a problem with how Unity Remote works?
Here is my code
IEnumerator StartLocationServiceCoroutine()
{
if (!LocationServiceEnabled())
{
if (OnLocationFail != null)
OnLocationServiceFail.Invoke();
yield break;
}
// start the service
Input.location.Start();
if (OnLocationStart != null)
OnLocationStart.Invoke();
//wait for initialization
int elapsed = 0;
while (elapsed < secondsBeforeTimeout
&& Input.location.status == LocationServiceStatus.Initializing)
{
yield return new WaitForSeconds(1f);
elapsed++;
}
print(Input.location.status.ToString());
switch(Input.location.status)
{
// timeout
case LocationServiceStatus.Initializing:
if (OnLocationTimeout != null)
OnLocationTimeout.Invoke();
StopLocationService();
yield break;
case LocationServiceStatus.Failed:
if (OnLocationFail != null)
OnLocationFail.Invoke();
yield break;
case LocationServiceStatus.Running:
if (OnLocationInitialized != null)
OnLocationInitialized.Invoke();
break;
}
}
Your answer

Follow this Question
Related Questions
Unity remote 4 with GPS and compass 0 Answers
How do I find out anything about the Unity Remote for Android that is available in Unity 3.2? 1 Answer
Ipad 3 and Unity Remote 3 default orientation ... 1 Answer
Streaming videos from web server in android 0 Answers
unity remote and windows 8.1 0 Answers