- Home /
Question by
jochempiejj · Apr 20, 2020 at 06:19 PM ·
webplayerwebglurlwww class
Load image from url in Webplayer
Hi, I try to load an image from an url (as texture of an 3D object).
In Unity it works but in the webplayer it don't
What can i do?
public Texture2D TextureTemplate;
// Use this for initialization
void Start () {
StartCoroutine(DownloadAdd1("http://www.mywebsite.com/3d/upload/TestTemplate1.png"));
}
// Update is called once per frame
void Update () {
}
IEnumerator DownloadAdd1(string url)
{
Texture2D texture = new Texture2D(40, 40, TextureFormat.DXT1, false);
WWW www = new WWW(url);
yield return www;
www.LoadImageIntoTexture(texture);
TextureTemplate = texture;
this.GetComponent<Renderer>().material.mainTexture = TextureTemplate;
}
}
Comment
Answer by asmanjitha · Sep 22, 2021 at 10:31 PM
I have the same issue, can someone suggest a solution?
Your answer
![](https://koobas.hobune.stream/wayback/20220612232006im_/https://answers.unity.com/themes/thub/images/avi.jpg)