Why do multiple Unity coroutines speed up www image loading?

I googled my way through lots of questions all day but I didn’t seem to find an answer fitting my problem, so I hope somebody can help me.

I want to display several image streams in a Unity scene. I have several GameObjects, each with the same loading-script attached and load my images via a coroutine in this script:

IEnumerator Load() { Texture2D tex = new Texture2D(4, 4, TextureFormat.DXT1, false); while (true) { WWW www = new WWW(url); yield return www; www.LoadImageIntoTexture(tex); img.texture = tex; } }

(Where img.texture is my image in the scene and url is the url i’m loading from).

This works fine for loading the images, but I notice the images load/ stream faster once I start more coroutines. To clarify, if i have 1 image stream it’s updating the images at a certain speed but if i have, e.g. 3 image streams (each having a coroutine for loading) suddenly all 3 streams load images faster than with 1 stream.

I tried adding a yield return new WaitForFixedUpdate(); at the end of the coroutine but it didn’t help, and i have no idea how to achieve a regular pace in loading new images, independent how many streams/coroutines i have at the same time? I hope it’s clear what i mean and any help is appreciated!

I can’t say for sure, but it’s probably a question of whether you are loading sequentially or concurrently.

If you have three coroutines, do they all start at the same time? If so, they send their requests more or less at the same time, and get their responses back very quickly one after the other.

If you have one coroutine, then each has to wait for the previous to complete before it can start the next.

Even though the first method is faster when you have one user, though, it could cause problems if the web server is unable to keep up with the volume of many users. Using the second method in that situation would give it a chance to breathe and may increase stability.