1 (edited by adri2111 2018-12-04 08:55:17)

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!

Re: Set a default target position

Hello.

Simply move the map to the desired location and click Save State.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Set a default target position

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!!

Re: Set a default target position

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.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

5 (edited by adri2111 2018-12-10 09:51:32)

Re: Set a default target position

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!

Re: Set a default target position

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).

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Set a default target position

Ok. Thaks for your help!