delay in unity
Code Example - delay in unity
Invoke("functionname", seconds);
// this is for C#
Time delay csharp unity
void start()
StartCoroutine(Text());
IEnumerator Text() // <- its a standalone method
{
Debug.Log("Hello")
yield return new WaitForSeconds(3)
Debug.Log("ByeBye")
}
unity csharp delay function
void start()
{
Invoke("DoSomething", 2);//this will happen after 2 seconds
}
void DoSomething()
{
Debug.Log("2 seconds has passed!");
}
unity call function after delay
Invoke("function", 2f);//f for float