private void Update() { if ((this.webRequest != null) && this.webRequest.isError) { Debug.Log(this.webRequest.error + " url: " + this.webRequest.url); } if ((this.webRequest != null) && (this.webRequest.isDone && !this.TexturesAreReady)) { Texture2D texture = ((DownloadHandlerTexture)this.webRequest.downloadHandler).texture; this.data.Add(new TextureData(this.filePaths[this.index], TextureLoadingUtility.CreateTextureWithGamma(texture))); this.convertedToNormalMap.Add(new TextureData(this.filePaths[this.index], TextureLoadingUtility.CreateNormalMap(texture))); Destroy(texture); this.index++; if (this.index < this.filePaths.Count) { this.LoadNextTexture(); } else { this.Complete(); } } }
public void Update() { if ((!this.IsReady && (this.loadingNormalMaps != null)) && !this.TryComplete()) { List <UnityWebRequest> list = this.loadingTextures.Keys.ToList <UnityWebRequest>(); for (int i = list.Count - 1; i >= 0; i--) { UnityWebRequest key = list[i]; if (key.isError) { Debug.Log(key.error); this.loadingTextures.Remove(key); } else if (key.isDone) { this.loadingTextures[key].coloringTexture = TextureLoadingUtility.CreateTextureWithGamma(((DownloadHandlerTexture)key.downloadHandler).texture); this.loadingTextures.Remove(key); } } list = this.loadingNormalMaps.Keys.ToList <UnityWebRequest>(); for (int j = list.Count - 1; j >= 0; j--) { UnityWebRequest key = list[j]; if (key.isError) { Debug.Log(key.error); this.loadingNormalMaps.Remove(key); } else if (key.isDone) { this.loadingNormalMaps[key].coloringNormalMap = TextureLoadingUtility.CreateNormalMap(((DownloadHandlerTexture)key.downloadHandler).texture); this.loadingNormalMaps.Remove(key); } } } }