title: Load and display image from a url
body: <p>I'm trying to load an image from url to GameObject.</p>
  
  <p>I found the next tutorial:</p>
  
  <p><a href="https://www.youtube.com/watch?v=8UK2EsKBzv8" rel="nofollow noreferrer">https://www.youtube.com/watch?v=8UK2EsKBzv8</a></p>
  
  <p>The download succeeded, but I can't see the image.</p>
  
  <p>What am I doing wrong?</p>
  
  <pre><code>// Use this for initialization
  void Start () {
      StartCoroutine(loadSpriteImageFromUrl("https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/408px-Google_2015_logo.svg.png"));
  }
  
  IEnumerator loadSpriteImageFromUrl(string URL)
  {
      // Check internet connection
      if (Application.internetReachability == NetworkReachability.NotReachable)
      {
          yield return null;
      }
  
      var www = new WWW(URL);
      Debug.Log("Download image on progress");
      yield return www;
  
      if (string.IsNullOrEmpty(www.text))
      {
          Debug.Log("Download failed");
      }
      else
      {
          Debug.Log("Download succes");
          Texture2D texture = new Texture2D(1, 1);
          www.LoadImageIntoTexture(texture);                      
          Sprite sprite = Sprite.Create(texture,
              new Rect(0, 0, texture.width, texture.height),      
              Vector2.one / 2);                                     
  
          GetComponent&lt;SpriteRenderer&gt;().sprite = sprite;    // Change current sprite
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/z3wyi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z3wyi.png" alt="Before Running"></a>
  <a href="https://i.stack.imgur.com/HKgI1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HKgI1.png" alt="After Running"></a></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>After moving as suggested from ScriptRenderer to UI Image, the code looks like this:</p>
  
  <pre><code>IEnumerator loadSpriteImageFromUrl(string URL, GameObject cell)
  {
      // Check internet connection
      if(Application.internetReachability == NetworkReachability.NotReachable)
      {
          yield return null;
      }
  
      var www = new WWW(URL);
      Debug.Log("Download image on progress");
      yield return www;
  
      if(string.IsNullOrEmpty(www.text))
      {
          Debug.Log("Download failed");
      }
      else
      {
          Debug.Log("Download succes");
          Texture2D texture = new Texture2D(1, 1);
          www.LoadImageIntoTexture(texture);                      
          Sprite sprite = Sprite.Create(texture, 
              new Rect(0,0, texture.width, texture.height),      
              Vector2.one/2);                                    
  
          cell.AddComponent&lt;Image&gt;();
          cell.GetComponent&lt;Image&gt;().sprite = sprite;    
      }
  }
  </code></pre>
  
  <p>But I'm getting next result to the screen (and not the image in the url):</p>
  
  <p><a href="https://i.stack.imgur.com/Cu4SA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cu4SA.png" alt="enter image description here"></a></p>