Wait For Seconds to Load level C#

Hi how do I make my level load after yielding for seconds in C#.

So far i’ve got.

    yield return new WaitForSeconds(5);


It doesn’t work how do i make this work. In java it works just find what the heck does C#need?


Well, i just wanted to like this page but unfortunately the C# example is wrong xD

At least the examples here: MonoBehaviour.StartCoroutine are correct.

You need to use StartCoroutine to start a coroutine and your function needs a name btw…

IEnumerator MyLoadLevel(float delay, int level)
    yield return new WaitForSeconds(delay);


okay thats what i needed thanks a bunch.

I temporarily fixed the problem by making a coroutine in java, then i threw it inside standard assets and was able to call it from my C# scripts. I’m glad you gave me this example though, i will be using it. If only the Unity Scripting guide would settle down and actually list REAL examples then we wouldn’t have such issues with SIMPLE things…

Thanks again