c# Wait until co routine is finished before executing code : <p>Hi im trying to implement saving/loading from sql database into my game.
i have it all working apart from the fact that i need to hit load twice for it to load the data. </p>

<p>the code to set the data finishes before i have a chance to set it.</p>

<pre><code>public void loadData()
{
    GetComponent&lt;SavingLoading&gt;().Load(GameObject.Find("LoginSystem").GetComponent&lt;LoginSystem&gt;().Username);

    if (GetComponent&lt;SavingLoading&gt;().LoadedData != "")
    {
        string[] Data = GetComponent&lt;SavingLoading&gt;().LoadedData.Split(',');

        Level = Convert.ToInt32(Data[0]);
        CurrentXp = Convert.ToInt32(Data[1]);
        currentHealth = Convert.ToInt32(Data[2]);
        maxHealth = Convert.ToInt32(Data[3]);

        Vector3 LoadedPos = new Vector3(Convert.ToSingle(Data[4]), Convert.ToSingle(Data[5]), Convert.ToSingle(Data[6]));
        transform.position = LoadedPos;
    }
}
</code></pre>

<p>Theese functions are in another script.</p>

<pre><code>public void Load(string name)
{
    StartCoroutine(LoadCall(name));
}



IEnumerator LoadCall(string name)
{
    WWWForm form = new WWWForm();
    form.AddField("name", name);

    WWW www = new WWW(LoadPhP, form);
    yield return www;
    string _return = www.text;
    LoadedData = _return;
}
</code></pre>

<p>how can i go about only updating the data if there is data present? without having to press the load button twice.</p>
