using System; using System.Net; using UnityEngine; public class IGNHook: MonoBehaviour { private void Start() { OnlineMapsTileManager.OnStartDownloadTile += OnStartDownloadTile; } private void OnStartDownloadTile(OnlineMapsTile tile) { string url = tile.url; tile.status = OnlineMapsTileStatus.loading; WebClient client = new WebClient(); client.Headers = new WebHeaderCollection() { { HttpRequestHeader.Referer, "https://macarte.ign.fr/carte/764c9a6f99cefe77881db9a4028edee8/Paris-2024"}, }; client.DownloadDataCompleted += (sender, e) => { if (tile.map == null) return; if (e.Error != null) { tile.MarkError(); Debug.Log(e.Error.Message); return; } Texture2D t = new Texture2D(1, 1); t.LoadImage(e.Result); t.wrapMode = TextureWrapMode.Clamp; tile.texture = t; tile.status = OnlineMapsTileStatus.loaded; tile.map.Redraw(); }; client.DownloadDataAsync(new Uri(url)); } }