Unity freezes when 'yield return executed' on specific scene


Unity freezes when Start() function executes ‘yield return new WaitForSeconds(1f)’ on specific Scene.
Other scenes work just fine.
I didn’t change any codes or anything but it just happened few days ago, and I have no idea why this happend. As you can see, there’s no ‘while’ so clearly it’s not about infinite loop.

I did ‘reimport all’, update unity(4.6.1f1) but it still happens

please help… any advice would be appreciated

btw this is the GameObject which casuses problem.
PlayManager script makes problem when it start Start() function

Turning Start() into a coroutine isnt advisable. It will mess everything up. If you REALLY want to fire a coroutine at Start, make a separate function and use ‘StartCoroutine’.

I’m not sure if this is the actual reason but based on the line:


It might be a case that in your code somewhere (inside an Update) depends on the GameState to be LOADING, which is actually inside a loop but since the GameState is set to be LOADING one second later the loop will never get LOADING state and goes into infinity.

Since there might be no error on the code, you might want to check in other areas

I have the same issue and it was the time.timescale that was set to 0 that made the coroutine’s yield to stop working. The code looks fine, so it might be something else that makes it error. I also used the Coroutine in Start and I know it’s working.

Try to check other possibilities for error beside your own code.