Skip to main content
added 132 characters in body
Source Link
KevLoughrey
  • 591
  • 3
  • 12

To start with, you should move the line

imagen.sprite =  Sprite.Create (img, new Rect(0,0,690,345),new Vector2(0.5f, 0.5f));

from Update() to the end of LoadImg() as you don't want to be creating a new sprite every time the game updates.

Your code looks mostly ok otherwise. Here's a working code sample which loads an image from a URL:. If it still doesn't work, comparing the two and modifying yours to match should fix the issue. https://answers.unity.com/questions/1175862/loading-a-sprite-from-url-c.html

To start with, you should move the line

imagen.sprite =  Sprite.Create (img, new Rect(0,0,690,345),new Vector2(0.5f, 0.5f));

from Update() to the end of LoadImg() as you don't want to be creating a new sprite every time the game updates.

Here's a working code sample which loads an image from a URL: https://answers.unity.com/questions/1175862/loading-a-sprite-from-url-c.html

To start with, you should move the line

imagen.sprite =  Sprite.Create (img, new Rect(0,0,690,345),new Vector2(0.5f, 0.5f));

from Update() to the end of LoadImg() as you don't want to be creating a new sprite every time the game updates.

Your code looks mostly ok otherwise. Here's a working code sample which loads an image from a URL. If it still doesn't work, comparing the two and modifying yours to match should fix the issue. https://answers.unity.com/questions/1175862/loading-a-sprite-from-url-c.html

Source Link
KevLoughrey
  • 591
  • 3
  • 12

To start with, you should move the line

imagen.sprite =  Sprite.Create (img, new Rect(0,0,690,345),new Vector2(0.5f, 0.5f));

from Update() to the end of LoadImg() as you don't want to be creating a new sprite every time the game updates.

Here's a working code sample which loads an image from a URL: https://answers.unity.com/questions/1175862/loading-a-sprite-from-url-c.html