How can I set an Image (PNG) from a URL to be the material of a sphere ??
Hi, Im trying to set an image that I'll download from a URL in order to use it as a texture for the material of a sphere.
Untill know, I haved been able to script it to downloaded and saved it into a Image variable, never the less I do not know how to use it into a texture so that then I can assignit to a Material and finally place it into my sphere ??
All of this I aiming to do it at run time by scrip. Any guess ???
IEnumerator place_ad_material(string ad_id, string add_template)
{
WWW wwwAd_Image = new WWW(DBManager.content_Path + "/" + DBManager.EventAuthorID + "/images/" + DBManager.ShowIMGURL);
yield return wwwAd_Image;
if (wwwAd_Image.texture != null)
{
vr_ad_image.sprite = Sprite.Create(wwwAd_Image.texture, new Rect(0, 0, wwwAd_Image.texture.width, wwwAd_Image.texture.height), new Vector2(0, 0));
}else
{
Debug.LogError("Error while Getting Ad ( " + ad_id + " ) Image" + wwwAd_Image.error);
}
}
Comment
Your answer
Follow this Question
Related Questions
How can i make a tiled/striped texture on a sphere ? (see example below) 0 Answers
Raw Image changing texture in inspector but not in game. 1 Answer
Base64 to texture decoding, js -> webgl 1 Answer
Lightweight RP change texture scale 0 Answers
Updating Property of Custom UI Image Material at Runtime 0 Answers