C# Load Level after seconds

Here is another C# issue that seemed to be easier in java, my code guy likes C# so I have been trying to save him a lot of time converting what I can to C#, I have tried looking this up but I keep finding these long over complicated methods to do something I believe should be quite simple. Anyways all I basically want to do is ad a slight delay in my C# script so the level will load after a short second or so. This is my very simple next level load code which works, just works too fast :wink:

using UnityEngine;
using System.Collections;

public class SCBlueButton : MonoBehaviour {
	
	
	public void  ModeSelect(){
		Application.LoadLevel("SurveillanceModeSelectScreen");
	}
}

hi

Use below mentioned code

 using UnityEngine;
 using System.Collections;
 
 public class SCBlueButton : MonoBehaviour {
     
     
     public void  ModeSelect(){
        StartCoroutine("Wait");
        
     }

IEnumerator Wait()
{
  yield return new WaitForSeconds(2);


Application.LoadLevel("SurveillanceModeSelectScreen");
    }
     }

2 can be changed to any value i.e the specific amount of time you want to wait before loading level.

Hello,

In C#,you can use code like this.

IEnumerator LoadAfterWait(string levelName)

{

yield return new WaitForSeconds(2f); // wait 2 seconds

Application.LoadLevel(levelName);

}

And you must start the coroutine like this:

StartCoroutine(LoadAfterWait(“SurveillanceModeSelectScreen”));

Thanks

Ram