async UniTask DoDownloadImageCaching() { var cachePathGenerator = new CachePathGenerator($"test-{Guid.NewGuid():N}"); var imageDownloader = new CachedImageDownloader(cachePathGenerator); var imageUrl = "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg"; var texture = await imageDownloader.Download(imageUrl); var textureCached = await imageDownloader.Download(imageUrl); Assert.IsFalse(texture.GetPixels().SequenceEqual(textureCached.GetPixels())); }
async UniTask DoDownloadImageNoCaching() { var imageDownloader1 = new CachedImageDownloader(new CachePathGenerator($"test-{Guid.NewGuid():N}")); var imageDownloader2 = new CachedImageDownloader(new CachePathGenerator($"test-{Guid.NewGuid():N}")); var imageUrl = "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg"; var texture1 = await imageDownloader1.Download(imageUrl); var texture2 = await imageDownloader2.Download(imageUrl); Assert.IsTrue(texture1.GetPixels().SequenceEqual(texture2.GetPixels())); }
public UniTask <Texture2D> LoadImage(string url) { return(_downloader.Download(url)); }