"Script error: Awake() can not be a coroutine."

I got this error with my script:

function Awake(){
print(Id +" online!");
if (Id > 0){
var form = new WWWForm(); 
form.AddField("GridNumber",Id);
var w = WWW(PHPUrl, form);
yield w;
if (w.error) {
print(w.error);
}else{
Ter = w.data;}
}
}

I need this script to run whenever a new instance of the script is created. (The object the script is in is cloned at the beginning of the game) Can someone help me work around this error? :wink:

Awake cannot contain โ€˜yieldโ€™. The solution is simple, just call another function (with the yield) from awake:

function Awake()
{
    DoWWWRequest();
}

function DoWWWRequest()
{
    print(Id +" online!");
    if (Id > 0)
    {
        var form = new WWWForm(); 
        form.AddField("GridNumber",Id);
        var w = WWW(PHPUrl, form);
        yield w;
        if (w.error) {
            print(w.error);
        }else{
            Ter = w.data;}
        }
    }
}

I think I am making too many data requests :smile:

then Unity crashes. :shock:

at the same time yeah. though you need a massive amount of them at the same time. on my win7 64bit system it was at dozens when I remember right, yet more than 4-10 requests in parallel are unrealistic cause you kill your server end or it will actually just reject them due to the max number of parallel connections

Its just for loading player information that is displayed on mouseover so Iโ€™ll just make it load the first time mouseover fires and remember it for the rest of the game.