After a couple of hours trying to figure out how to fix this error (I have already look almost all answers of WWW not working and so), I have decided to post it here. Hope someone can help me ^^’
The problem is: I have a very simple call of WWW that sends info to PHP. But, every URL I test it gives me this error:
WWW Error:
UnityEngine.Debug:Log(Object)
c__Iterator0:MoveNext() (at
Assets/SendInfo.cs:25)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator,
IntPtr)
This is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SendInfo : MonoBehaviour {
public void SendScore()
{
string url = "http://www.web.url/sendinfo.php?score=" + Player.totalPoints;
WWW www = new WWW(url);
StartCoroutine(WaitForRequest(www));
}
IEnumerator WaitForRequest(WWW www)
{
yield return www;
if (www.error == null)
{
Debug.Log("WWW Ok!: " + www.text);
}
else
{
Debug.Log("WWW Error: " + www.error);
}
}
}
It just can’t connect to any URL. Have tried several things, I though it was the PHP code but it isn’t. A simple connection to google.com won’t work either.
Am I doing something wrong? If not, any way to try to fix?
Thank you!