Topic: Cached map area download problem

Hello. I have a problem with showing cached areas at the map. The problem is that i implemented my own download engine to resources and when i switch off mobile data or set resources source at editor, zoom levels just dont change when i increase them.

My steps:

1) download some area : image attach left
2) zoom in in this area : image attach right

What i've tried to do:
1) Save in Resources/OnlineMapsTiles/zoom/x/y
2) Save in Resources/Tiles/zoom/x/y
3) Save in Resources/OnlineMapsCache/provider/x/y

The behaviour is the same. Also i tried to use … 4612#p4612 this script and nothing changed. What can be the problem?
Also i debuged "TryLoadFromFileCache" method and it does not called when i increase zoom and dont get why, if new tiles should be checked when they are load in "InitTile" in Updating Buffer.

Post's attachments

Attachment icon 6NG1R2M.png 362.36 kb, 3 downloads since 2020-11-10 

Re: Cached map area download problem


Where do you save the data in the script you implemented? To Resources folder?
You don't have write access to Resources after build.
Typically, Application.persistentDataPath folder is used for these purposes. … aPath.html

TileDownloader stores tiles in persistentDataPath.

The cache is also not stored in Resources, and the file cache tries to load only the tiles that are present in the atlas.

Re: Cached map area download problem

yes, i save in application data path and permissions are ok, the path is like:
for example, and map does not switch to 17 zoom at all, while i ve downloaded this area

Re: Cached map area download problem

Intercept requests to load tiles this way ... … ample.html
... and read the tiles from your path.

Tip: do not use the cache folder for your tiles, because this will create two problems:
1. The cache will not load and/or delete these files because they are not in the atlas.
2. If you delete them yourself, then how do you know if this file is not in the atlas, which can create dead records in the atlas.

Re: Cached map area download problem

The problem is that i want to store files at cache folder because i want to save different providers for offline usage, also can i manually add downloaded textures to atlas?
Or i should manually resolve the cases when i have inet conection to use cache normally and no inet conection and use my own folders?

Re: Cached map area download problem

No, you cannot add items to the tile cache or atlas. The cache is simply not designed for this.

No, you don't have to resolve it manually.

How tile loading works:
1. If a tile is in the cache, it is loaded from the cache.
2. If someone has subscribed to OnStartDownloadTile, this event is called, where you can load the tile yourself or do some action, and continue downloading using the built-in downloader. If you loaded a tile yourself, then it is not cached.
3. If the settings indicate that a tile should be loaded from Resources or Streaming Assets, the tile is searched for in these folders.
4. The tile is loaded from the Internet.

So you need to subscribe to OnStartDownloadTile, and download the tile from your folder.

How to get the provider id:

private void OnStartDownloadTile(OnlineMapsTile tile)
    // ...
    OnlineMapsRasterTile rTile = tile as OnlineMapsRasterTile;
    string provider_id =;

    // ...

Re: Cached map area download problem

ty for your help, it working great now, but the problem now is that there are grey tiles on reload, but there it was working better before loading from my source, how to make smooth reload tiles on zoom?

Re: Cached map area download problem

Please show your code where you load the tiles.

Re: Cached map area download problem


Re: Cached map area download problem

I checked your code and it works correctly on my side.
Video: … 3.mp4?dl=0

A couple of things about the video:
1. I disabled the cache and commented out part of the script so that tiles are loaded only from your path.
2. I set Count Parent Tiles to 0 so that parent tiles do not affect the view of the map, and tiles are unloaded when zoom in, and loaded again when zoom out.

11 (edited by wththd 2020-11-12 10:54:11)

Re: Cached map area download problem

i mean if i disable my script - tiles load without being gray like this
when i activate my script, there is grey tiles appear after zoom in/out
like this

Re: Cached map area download problem

I just checked the map in all modes, and for me it only happens when Count Parent Levels - 0, which is logical, because the map unloads all previous zoom levels when the zoom changes.
Please show screenshots of all of your map components (including Advanced and Troubleshooting sections of the map component).

13 (edited by wththd 2020-11-12 12:28:22)

Re: Cached map area download problem

Yes, sorry, it was my fault, because i set parent levels to 0. Thank you very much for your help. Last question: i tried to use your example inertia but it is not smooth enough, even if i tried to use smoothdamp on speed and increasing max samples  is there any suggestions to improve example inertia?

Re: Cached map area download problem

Please clarify what you mean by "is not smooth enough"?
I just tested this on my side and it is very smooth. Video: … 4.mp4?dl=0
Unfortunately, the video doesn't quite convey the smoothness I have on the device.
But believe me, there are no freezes or lags here.
Maybe I'm just looking in the wrong direction.

Re: Cached map area download problem

The map moves jumpy on slow speed, im now using default inertia script with default 0.9 value

Re: Cached map area download problem

Unfortunately I don't see a problem here.
I compared the inertia in Online Maps and the inertia in Google Maps, and I think it looks very similar.