public IEnumerator RequestImage(DownloadMediaEventArgs media) { Debug.Log(string.Format("Requesting Image {0}", media.FileName)); if (media.FileName.Length <= 0 || media.FileName == null) { yield break; } var www = UnityWebRequestTexture.GetTexture( ServerURL.DownloadMediaUrl(media.FileName)); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); yield break; } var texture = ((DownloadHandlerTexture)www.downloadHandler).texture; var textureArgs = new DownloadTextureEventArgs { DownloadGuid = media.DownloadGuid, FileName = media.FileName, MediaType = media.MediaType, ImageTexture = texture }; Debug.Log("Image Download Successful."); EventManager.OnTextureDownloaded(textureArgs); }
public static void OnTextureDownloaded(DownloadTextureEventArgs e) { Debug.Log("Texture downloaded event triggered."); var handler = TextureDownloaded; if (handler != null) { handler(null, e); } }