UnityWebRequest error www.downloadHandler.text
IEnumerator EnviarPregunta(long code, string p) { using (var www = new UnityWebRequest("http://127.0.0.1:5880/Recibido?code=" + code + "&msg=" + p, "GET")) { yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Debug.Log(www.downloadHandler.text); } } }
could you please share the error message or console?
I am trying to communicate from the Edge web browser to the unity editor where the httpserver is. If you type in the browser url directly:
it works correctly and returns a Json.
But if I make this request from a compilation in webGL it returns null (or I don't know how to get the json)
www.downloadhandler.text <--- is null
public ReturnResult Recibido(long code, string msg) { ReturnResult result = new ReturnResult { code = code, msg = msg }; return result; }
Thanks!
public ReturnResult Recibido(long code, string msg)
{
ReturnResult result = new ReturnResult
{
code = code,
msg = msg
};
return result; // try set the breakpoint in Unity editor here!
}
To tested the issue is from webgl side or the UnityHTTPServer side, I suggest to set a breakpoint as upper, and see if the break point is trigger or not.
If the breakpoint is triggered, then I think the issue is inside the WebGL build, maybe something like il2cpp script code strip etc.