Looks like you want to downloaded data then wait then wait for the download to finish then download another data. If this is true the you can the code below will download data 2 times. You can increase the number of times by increasing the REQ_AMOUNT
value.
It uses yield return StartCoroutine
to wait for the current coroutine function to return before running again.
IEnumerator Start()
{
int REQ_AMOUNT = 2;
for (int i = 0; i < REQ_AMOUNT; i++)
{
yield return StartCoroutine(GetSettings());
}
}
IEnumerator GetSettings()
{
string url = RoomSettings.AbsoluteFilenamePath;
if (Application.isEditor)
{
url = "file:///" + url;
}
var www = new WWW(url);
yield return www;
// Do some code, when file loaded
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…