x


WaitForSeconds does not work

Here is my coroutine :

IEnumerator SyncLevelCoroutine(LevelData a_level)
{         
    Network.SetSendingEnabled(0, false);
    Network.isMessageQueueRunning = false;

    Network.SetLevelPrefix(1);
    Application.LoadLevel(a_level.m_szLevelName);

    while(m_nStatus == EStatus.eSynchronizing)
    {
       yield return new WaitForSeconds(0.1f);
    }

    Network.isMessageQueueRunning = true;
    Network.SetSendingEnabled(0, true);

    if(Network.isServer)
    {
       SetReady();
    }
    else
    {
       networkView.RPC("SetReady", RPCMode.Server);
    }
}

and here is the call of the coroutine :

StartCoroutine("SyncLevelCoroutine", level);

The coroutine is stopped in the WaitForSeconds statement. I have tried to put a Debug Log before this line, but the log is shown only once. Any log after the while loop is not shown. If I replace "yield return new WaitForSeconds(0.1f)" by "yield return null", it works. Any idea why WaitForSeconds lasts an eternity?

more ▼

asked Mar 13 '13 at 06:10 PM

Tourist gravatar image

Tourist
261 3 6 11

this guy had a similar problem. http://answers.unity3d.com/questions/60725/waitforseconds-problem-with-unity-pro.html

Check your timescale in your project settings. Maybe thats the issue.

Mar 13 '13 at 07:15 PM PAEvenson

well thank you, that was that... I m feeling so dumb right now...

Mar 14 '13 at 09:24 AM Tourist
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

see comment

more ▼

answered Mar 14 '13 at 09:24 AM

Tourist gravatar image

Tourist
261 3 6 11

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x507
x238

asked: Mar 13 '13 at 06:10 PM

Seen: 359 times

Last Updated: Mar 14 '13 at 09:24 AM