Is there any way to delay actions?
Use coroutines?
void DoSomething(){ StartCoroutine("delayedaction"); }
IEnumerator delayedaction()
{
yield return new WaitForSeconds(2);
//do something
}
You can also just use Invoke.
void DoSomething(){ Invoke("delayedaction", 2); }
void delayedaction{
//do something
}
Hmmmmm…ok.
I wish there was an easier way like delay(1) or sleep(1000).
maybe they will add a delay function in the future…but for now coroutines and Invokes with waitForSeconds work just as good…plenty of examples in these forums…just search
That would lock the thread the game is running on. The game loop is a single thread and that’s partly why you need coroutines or Invoke.