Answers for "how to wait for a few seconds in unity function"

5

c# wait for seconds

using System;
using System.Threading;

class Example
{
    static void Main()
    {
        for (int i = 0; i < 5; i++)
        {
            Console.WriteLine("Sleep for 2 seconds.");
            Thread.Sleep(2000);
        }

        Console.WriteLine("Main thread exits.");
    }
}

/* This example produces the following output:

Sleep for 2 seconds.
Sleep for 2 seconds.
Sleep for 2 seconds.
Sleep for 2 seconds.
Sleep for 2 seconds.
Main thread exits.
 */
Posted by: Guest on March-23-2020
5

wait for time javascript

//code before the pause
setTimeout(function(){
    //do what you need here
}, 2000);
Posted by: Guest on November-28-2019

Code answers related to "how to wait for a few seconds in unity function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language