Topic: Custom tile server overlay?


I am really really new to Unity and the Online Maps, but come from having working some with mapbox-gl.

What's the best way to add a map layer from a custom tile server on top of the base map?

Here's one that I'm interested in:${z}/${x}/${y}.png

(and more here:

Would I be able to cache/offline these as well?

Sorry if I'm asking silly questions, but I couldn't find any immediate answers by searching smile

Re: Custom tile server overlay?


How to overlay: … ample.html
This example loads overlay from the Resources folder. Instead, you need to make a request to the server you want. … ea56c0a5ab

You can save downloaded data yourself and save to Application.persistentDataPath. … aPath.html
Or you can use Online Maps cache (OnlineMapsCache.Add / OnlineMapsCache.Get).

Re: Custom tile server overlay?

Thank you! And cool, I got it to work!

Re: Custom tile server overlay?

Well, one big memory leak problem still.

I've tried copying the examples, but I'm sure there's something obviously wrong with how I do it since there is huge leakage smile I tried updating the tile status to loading - loaded - etc, but I couldn't figure it out.

Post's attachments

Attachment icon OpenSeaMapLayer.cs 1.93 kb, 7 downloads since 2020-09-29 

Re: Custom tile server overlay?

I've tested your script with and without cache and I don't see any memory leak.
Please tell me more about the memory leak.
How did you find this? And maybe something else is required for the leak to start?

Re: Custom tile server overlay?

Oh, interesting. I will research some more about what's happening and get back to you.

I didn't notice anything when running within Unity-- everything seemed fine. Only when running on an iOS device the app kept crashing and I noticed it was hitting the 1.4GB memory limit quickly just by scrolling the map slightly to the left and back right. And by disabling that script the leak went away.

But I'll get back.

Re: Custom tile server overlay?

I found the fix here: … n-ios.html

After lifting the variable out of the function and doing some disposing/unloading the memory usage seems stable on iOS.

Post's attachments

Attachment icon OpenSeaMapLayer.cs 2.02 kb, 8 downloads since 2020-10-01