- Home /
WWW requests are exponentially slow on large web pages (xml)
I have noticed that serving large web pages over the WWW class in a webplayer game becomes extremely slow.
I use the server to send custom assets as xml and sometimes they can take a few MB or even several hundred MB. The bandwidth starts high and decreases over time as CPU increases (even though I do nothing but yield for the WWW object to finish. It looks exactly as if Unity was doing something like this:
while (isThereMoreData)
{
Download a bit of xml data
WWW.text += aBitMoreText;
}
Which, on large text data, would end up getting the text buffer moved and copied in memory as its size increases..
I have checked my http headers and they indicate the content size correctly, which means that the WWW object could pre-allocate the memory buffer.
Has anyone else experienced this and found a work around?
Did you ever find anything? I'm having the same problem.
Answer by FlaSh-G · Jun 23, 2017 at 02:54 PM
The UnityWebRequest class can be considered WWW 2.0 and I am pretty sure that it allows you to accomplish your goal.