delay in unity c# code example
Example 1: Time delay C# unity
void start()
StartCoroutine(Text());
IEnumerator Text() // <- its a standalone method
{
Debug.Log("Hello")
yield return new WaitForSeconds(3)
Debug.Log("ByeBye")
}
Example 2: how to delay something in c# unity
Invoke("DoSomething", 2);//this will happen after 2 seconds
Example 3: wait time in unity
using System.Collections;
private void Start()
{
StartCoroutine(Wait());
}
IEnumerator Wait()
{
//To wait, type this:
//Stuff before waiting
yield return new WaitForSeconds(/*number of seconds*/);
//Stuff after waiting.
}