How wait few second in c#

Hi, i want to make an easy menu, i wrote this:

void Update () {

	StartCoroutine("wait");

     // other

}

IEnumerator wait(){
	yield return new WaitForSeconds(5.0f);
}

it doesn’t work, it doesn’t wait… D:
What it goes wrong ?

Your process should be put inside the IEnumerator, not below StartCoroutine.
The system starts the coroutine (the IEnumerator function), but carries on doing its task. But what’s below the line “yield return new WaitForSeconds(5f);” is what will happen after those 5 seconds.

You need to do something after the coroutine - “//other” needs to be inside the coroutine

You can also use a closure to do that like this:

 IEnumerator WaitThenDo(System.Action thingToDo) {
     yield return new WaitForSeconds(5);
     thingToDo();
 }

 StartCoroutine(Wait(()=>{
     //other
 })