Quantcast
Channel: Questions in topic: "webrequest"
Viewing all articles
Browse latest Browse all 387

Problem to get texture2D in IEnumerator with UnityWebRequest

$
0
0
Hi, in my app I get text and picture from a php script to built a news. I get the without problem with text with : UnityWebRequest www = new UnityWebRequest(m_SendURL); www.downloadHandler = new DownloadHandlerBuffer(); yield return www.Send(); for the picture I built an IEnumerator like this : IEnumerator LoadTheNewsImage(string url, Texture2D texImage) { UnityWebRequest wwwim = UnityWebRequest.GetTexture(url); www.downloadHandler = new DownloadHandlerBuffer(); yield return www.Send(); texImage = DownloadHandlerTexture.GetContent(wwwim); } and I call it in an iterative loop like that : Texture2D imageTx = new Texture2D(300, 300, TextureFormat.RGB24, false); StartCoroutine(LoadTheNewsImage(newsToAdd.urlImage, imageTx)); But imageTx remains empty and I have a grey square on the screen, If I use the same code out of the loop without IEnumerator it works fine I spent more than 2 days trying any kind of alternative without success. Thanks for the help

Viewing all articles
Browse latest Browse all 387

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>