Hi! What I need to do is download an image from a url and display it in a UI.Image component (so as sprite). I managed to do this with the script below, but only seems to work in unity, while not working on my android tablet (application crash).
public void Start () {
StartCoroutine(RealLoadImage());
}
private IEnumerator RealLoadImage () {
string url = "http://www.MY_URL_IMAGE...";
WWW imageURLWWW = new WWW(url);
yield return imageURLWWW;
if(imageURLWWW.texture != null)
{
Sprite sprite = new Sprite();
sprite = Sprite.Create(imageURLWWW.texture, new Rect(0, 0, imageURLWWW.texture.width, imageURLWWW.texture.height), Vector2.zero);
GetComponent<UnityEngine.UI.Image>().sprite = sprite;
}
yield return null;
}
This script is attached to the UI.Image