Topic: Dynamic MapBox Map type at runtime in Unity

Hi Community

We use prefabs of Infinity maps with different MapIDs set in the inspector, the idea is to load a different prefab when a user changes game.

This is not working at present, which ever mapID style that loaded first persists, we tried to solve this by detecting a change and telling the Online_Maps_cache  to clear the cache and reload the map, but this doesn't work either.

I looked at this guide: http://infinity-code.com/atlas/online-m … ample.html

But I am unable to make them work with our custom mapbox styles, I just get blank maps.

Any ideas?

Re: Dynamic MapBox Map type at runtime in Unity

Hello.

Most likely you have created the styles url incorrectly.
Please send me the map id and user id of your styles.
If your styles are not public, also send your access token.
I will check it.

P.S. The information I requested is private, so in this case it is better to use email (support@infinity-code.com) rather than the forum.
And of course, I guarantee that the information will not be shared to third parties, or used for purposes not related to providing support to you.

Kind Regards,
Infinity Code Team.

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

Re: Dynamic MapBox Map type at runtime in Unity

Alex Vertax wrote:

Hello.

Most likely you have created the styles url incorrectly.
Please send me the map id and user id of your styles.
If your styles are not public, also send your access token.
I will check it.

P.S. The information I requested is private, so in this case it is better to use email (support@infinity-code.com) rather than the forum.
And of course, I guarantee that the information will not be shared to third parties, or used for purposes not related to providing support to you.

Hello Alex, I believe it was a malformed URL, I got it working by the end of the day by copying the format of the provider from  OnlineMapsProvider.cs and making my own provider.

urlWithLabels = "https://api.mapbox.com/styles/v1/{useri … cesstoken}",

Thank you for your reply.

Re: Dynamic MapBox Map type at runtime in Unity

Is there a way to get the current provider and style loaded from OnlineMaps?

We need to validate what style is loaded on first run, currently we simply set it again but i'm concerned that will cause a cache clear?

Re: Dynamic MapBox Map type at runtime in Unity

https://infinity-code.com/doxygen/onlin … 85773567ac
https://infinity-code.com/doxygen/onlin … 3d23da3796

Kind Regards,
Infinity Code Team.

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