Topic: Set a default target position
Hi.
I am working to set the default character position when the GPS is without signal. What is the best practice in this case?
Thanks!
You are not logged in. Please login or register.
Infinity Code Forum → Online Maps Help → Set a default target position
Hi.
I am working to set the default character position when the GPS is without signal. What is the best practice in this case?
Thanks!
Hello.
Simply move the map to the desired location and click Save State.
Sorry... I didn't explain good my question.
I am working in a mobile game. I want to store the last device position and use it when the device doesn't have gps signal.
So I need some script example to setup the map sition and the user marker position with my saving values.
Thanks!!
Subscribe to OnlineMapsLocationServiceBase.OnLocationChanged, and save the user's position into PlayerPrefs.
http://infinity-code.com/doxygen/online … 79479dbafe
https://docs.unity3d.com/ScriptReferenc … Float.html
When starting the script, check for the presence of the old location, and if it is present, restore it.
Thanks for your tip.
In the documentation, we can read: "Important: position not available Start, because GPS is not already initialized.
Use OnLocationInited event, to determine the initialization of GPS."
The initialization of the GPS only happens when the GPS send the first Position, that is correct?
So I can not setup the position without GPS active. Is another way to set up the position when the GPS not is running?
Thanks!
Yes, OnLocationInited is called when the first location is received.
Earlier you wrote:
I want to store the last device position and use it when the device doesn't have gps signa
So you have a location from a previous gaming session, so you can use it.
Just set this position of the map (OnlineMaps.SetPosition).
Ok. Thaks for your help!
Infinity Code Forum → Online Maps Help → Set a default target position
Powered by PunBB, supported by Informer Technologies, Inc.