How to take an image from web
Hello!
I try to take an image from the web and to display it into a UI through an image element.
Here is my code:
 public class RequestAPI : MonoBehaviour {
 public Image bookImage;
 public void RunAPI()
     {
      WWW www = new WWW(Carte.GetImageUrl());              
         bookImage.sprite = Sprite.Create(www.texture, new Rect(0, 0, www.texture.width, www.texture.height), new Vector2(0, 0));
     }
 }
When I run the game I receive the following error:
„You are trying to load data from a www stream which has not completed the download yet. You need to yield the download or wait until isDone returns true. UnityEngine.WWW:get_texture()”
Is there anybody here who knows to solve this problem? I mention that the url of the image is obtained through a xml file that I receive when I make a request to a server.
Thank you very much!
Your answer
 
 
             Follow this Question
Related Questions
Cannot Get Facebook Profile Picture Using www in Unity Facebook SDK 4 Answers
Issue with WWW/UnityWebRequest when sending JSON to server 1 Answer
IPv6 WWW issue 0 Answers
How to load textures on run-time for a game that is built for WebGL 0 Answers
Finding audio clips in a specific folder if it is exist (Android) 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                