- Home /
Question by
Player-of-Players · Jul 25, 2017 at 02:35 PM ·
webglwwwserver-hostingwww.texture
Texture is not loading using WWW class in WebGL build.
The project runs properly on editor, but not when uploaded to the server. In my project, i am fetching some detail from a table on my server and a profile pic using a link, I am getting all the data from table successfully, but profile picture is unable to load. here is the code i written.
string profileLink;
IEnumerator LoadWebData(WWW www)
{
yield return www;
if (string.IsNullOrEmpty(www.error) && !www.text.Contains("record not found"))
{
usr = JsonReader.Deserialize<UserData>(www.text);
name_p1.text = usr.display_name;
name_p2.text = usr.display_name;
point_p1.text = usr.points;
point_p2.text = usr.points;
karma_p1.text = usr.level;
karma_p2.text = usr.level;
}
if (usr.profile_pic != "")
{
profileLink = "www.twitchtime.com/doforward/wp-content/uploads/2017/" + usr.profile_pic;
WWW www2 = new WWW(profileLink);
StartCoroutine(LoadProfilePic(www2));
}
}
IEnumerator LoadProfilePic(WWW www2)
{
yield return www2;
if (string.IsNullOrEmpty(www2.error))
{
profilePic.mainTexture = www2.texture;
profilePic2.mainTexture = www2.texture;
debugStr.text = profileLink;
}
debugStr.text = www2.error;
}
It shows unknown error in debugStr label.
Comment
I've edited your post to make the code more readable. For next time please note that you should use the button with 101010 on it to paste code in.
Your answer
![](https://koobas.hobune.stream/wayback/20220612131132im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Cant load texture by WWW in WebGL 0 Answers
Unity + Cors in WebGL 1 Answer
View Ip cameras remotely over the internet 0 Answers
IP blocked for pulling images using WWW class 1 Answer
How to send a string from a website to the webGL game 0 Answers