unity how to wait 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: how to make a method wait in unity
public float timeLeft = 30.0f
void Update()
{
timeLeft -= Time.deltaTime;
if (timeLeft < 0)
{
}
}
Example 4: wait time in unity
using System.Collections;
private void Start()
{
StartCoroutine(Wait());
}
IEnumerator Wait()
{
yield return new WaitForSeconds();
}