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
↧