using UnityEngine; using System.Collections; public class LoadTMSTiles : MonoBehaviour { private OnlineMaps api; private string resourcesPath = "OnlineMapsTiles/{zoom}/{x}/{y}"; // Use this for initialization void Start () { api = OnlineMaps.instance; api.OnStartDownloadTile += OnStartDownLoadTile; } // Update is called once per frame void OnStartDownLoadTile(OnlineMapsTile tile) { // Load tile texture from cache. Texture2D tileTexture = new Texture2D(256, 256); int z = tile.zoom; int ymax = 1 << z; int y = ymax - tile.y - 1; tile.y = y; // <<<----------- Here you load the texture of the tile. tileTexture = Resources.Load(tile.resourcesPath) as Texture2D; // Send texture to map. if (api.target == OnlineMapsTarget.texture) { tile.ApplyTexture(tileTexture); api.buffer.ApplyTile(tile); } else { tile.texture = tileTexture; tile.status = OnlineMapsTileStatus.loaded; } // Redraw map. api.Redraw(); } }