From b594abf4dd05feecd34a10d09bd212be88beff44 Mon Sep 17 00:00:00 2001 From: alexiscatnip Date: Sat, 30 Jul 2022 01:47:48 +0800 Subject: [PATCH] refactor: fix NRE due to restarted scene --- Assets/Raindrop/UI/Map/MapService/MapTilesNetwork.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Assets/Raindrop/UI/Map/MapService/MapTilesNetwork.cs b/Assets/Raindrop/UI/Map/MapService/MapTilesNetwork.cs index 20e1e24..223c99d 100644 --- a/Assets/Raindrop/UI/Map/MapService/MapTilesNetwork.cs +++ b/Assets/Raindrop/UI/Map/MapService/MapTilesNetwork.cs @@ -15,13 +15,11 @@ namespace Raindrop.Map.Model List tileRequests = new List(); // a list of pending fetch requests. the ulongs are the x and y world coordinates (gridX * 256), packed. private DownloadManager downloader; - UnityMainThreadDispatcher mainThreadInstance; public MapTilesNetwork(int parallelDownloads) { downloader = new DownloadManager(); downloader.ParallelDownloads = parallelDownloads; - mainThreadInstance = UnityMainThreadDispatcher.Instance(); } //get region tile using SL map API -- JPEG images. @@ -77,7 +75,8 @@ namespace Raindrop.Map.Model // } //start to run jpeg decoding on the main thread. - mainThreadInstance.Enqueue(DecodeDataToTexAsync(res, responseData)); + UnityMainThreadDispatcher.Instance(). + Enqueue(DecodeDataToTexAsync(res, responseData)); // remove from request list lock (tileRequests)