wait seconds unity c# 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 for seconds unity
Start()
{
StartCoroutine(Example());
}
Example()
{
Debug.Log("Hello");
yield return new WaitForSeconds(3);
Debug.Log("Goodbye");
}
Example 3: unity wait for seconds
void start() => StartCoroutine(MyIEnumerator());
IEnumerator MyIEnumerator()
{
Debug.Log("Hello world!");
yield return new WaitForSeconds(3);
Debug.Log("Goodbye world!");
}
Example 4: waitforseconds unity
public void GameOver()
{
levelText.text = "After " + level + " months, you starved.";
new WaitForSeconds(6);
Application.Quit();
}