WWW, RESTful Service, and Threading

I have a basic unity scene that should instantiate game objects based on the result of a simple GET of a RESTful web service. I have a very simple example of calling this web service here from unity:

using UnityEngine;
using System.Collections;

public class Updater : MonoBehaviour {

    void Start () {
        string url = "http://MyRestfulServiceUrl/Service1.svc/someGetMethod?id=1";
        WWW www = new WWW(url);

    IEnumerator WaitForRequest(WWW www)
        yield return www;

        // check for errors
        if (www.error == null)
            Debug.Log("WWW Ok!: " + www.data);
        } else {
            Debug.Log("WWW Error: "+ www.error);


The result of the web service may take a second or 2 to respond. Additionally the response data may be a blob of XML that needs to be parsed - However I do not want these operations to effect the main UI thread. Is using threads to create a background ‘call web service and parse response’ thread an appropriate solution? Are there better/alternate solution to consider?

PS I am not too familiar with coroutines but my understand is that they are not really asynchronous background threads?

Coroutines are not threads, they are just routines that execute partially on the main thread and then continue from where they left off later.

You can’t use the Unity API from a second thread, but you can certainly process data. I use threads to run ZXing and detect qr codes which works quite well.