yield wait for seconds code example
Example 1: Time delay C# unity
void start()
StartCoroutine(Text());
IEnumerator Text()
{
Debug.Log("Hello")
yield return new WaitForSeconds(3)
Debug.Log("ByeBye")
}
Example 2: wait time in unity
using System.Collections;
private void Start()
{
StartCoroutine(Wait());
}
IEnumerator Wait()
{
yield return new WaitForSeconds();
}
Example 3: waitforseconds unity
public void GameOver()
{
levelText.text = "After " + level + " months, you starved.";
new WaitForSeconds(6);
Application.Quit();
}