Answer the question
In order to leave comments, you need to log in
What is the reason for the incomprehensible coroutine delay in UnityWebRequest?
There is a server and a client, now on the same machine, but the problem is that there is a delay of 3 seconds, which, apparently, occurs in the waiting coroutine, but why it occurs is not clear.
The coroutine itself looks something like this:
IEnumerator GetText() {
UnityWebRequest www = new UnityWebRequest("http://www.my-server.com");
www.downloadHandler = new DownloadHandlerBuffer();
yield return www.Send();
if(www.isError) {
Debug.Log(www.error);
}
else {
// Show results as text
Debug.Log(www.downloadHandler.text);
// Or retrieve results as binary data
byte[] results = www.downloadHandler.data;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question