Yield waitforseconds(); not working

Hello everyone, yield WaitForSeconds(); was working properly on javascript and same on C# using StartCoroutine(); I upgraded unity to 4.1.5 f1 and now its not working. Statements after yield waitforseconds are never called. Somebody please tell me the solution. Thanks

Hmm…

All of mine are working.

Can you provide some code?

javaScript:

noticeLabel.SetActive(true);
noticeLabel.SendMessage(“SetColor”,Color.green,SendMessageOptions.DontRequireReceiver);
noticeLabel.SendMessage(“SetText”,“+$”+1,SendMessageOptions.DontRequireReceiver);

yield WaitForSeconds(2.0f);
noticeLabel.SetActive(false);

c#:

void KeysPressed () {
if (GameObject.Find(“DrinksObject”).GetComponent().GetIsPressed()) {
return;
}
GameObject.Find(“DrinksObject”).GetComponent().SetIsPressed();
StartCoroutine(gotoNext());
}

IEnumerator gotoNext () {
yield return new WaitForSeconds(3.0f);
Resources.UnloadUnusedAssets();
Application.LoadLevel(“NextScene”);
}

They look ok as far as I can tell. Did you try to add a Debug.log?

I would place one just before the “StartCoroutine(gotoNext());” then one just after the “IEnumerator gotoNext () {”

to make sure the functions are being called.

Yes i tried with logs and also tried with break points. Execution is perfect upto yield waitforseconds, statements after these lines are never executed.
Does it have anything to do with time settings or anything else in project setting=> Time or any other settings?

Absolutely,

Is your time setting set to 0?

Is wont wait for sec if time is set to 0.

Time scale = 1
Fixed timestep = 0.02
max allowed time = 0.3333

I just noted that its working in every other scene except the scene where I require to run

I added an array of 10 audio sources after which this stopped working. Now i have removed it and its working fine. Why this problem? I want 10 audiosources but then it creates this problem.

Found the problem. I was using yield waitforseconds in audio source to play specific sound once a certain sound is played(using length of sound file). Audio file was corrupt and it showed invalid time so the loop got hanged in an infinite loop.