- Home /
unity www request not working,Cannot load texture from php file
Hi everyone, I moved my project from 2017.1 to 2018. I'm loading textures from php server dynamically, it works on 2017 but not on 2018. here is my code @Aurimas-Cernius
string URL = "http://randomserver/test.php"; void Start () { StartCoroutine ("getTextures");
}
IEnumerator getTextures(){
using (WWW www = new WWW(URL))
{
yield return www;
if (www.error != null)
{
Debug.Log("Error Loading Ads");
}
else
{
string downlo = www.text;
string[] desTextSplit = downlo.Split('\r');
Debug.Log(desTextSplit[1]); /// IT RETURNS IMAGE URL CORRECTLY
WWW wwwLo = new WWW(desTextSplit[1]);
while (!wwwLo.isDone)
{
Debug.Log("Download image on progress" + wwwLo.progress);
yield return null;
}
if (!string.IsNullOrEmpty(wwwLo.error))
{
Debug.Log("Download failed" + wwwLo.error); // ERROR Cannot connect to destination
}
else
{
Debug.Log("Download succes");
Texture2D texO;
texO = new Texture2D(1, 1);
yield return wwwLo;
texO.LoadImage(wwwLo.bytes);
texO.Apply();
Texture tt = wwwLo.texture;
One.texture = texO;
}
}
}
}
this code still works on 2017. please help me
Comment
Your answer
Follow this Question
Related Questions
How can I read a php file in localhost or remote from unity editor 2 Answers
WWW Class is acting up 1 Answer
Unity WWW gzip 1 Answer
variable from php to unity 1 Answer