Answers for "function that makes something wait for 3 seconds in unity"

C#
6

wait for a second unity

void Start()
    {
        //Start the coroutine we define below named ExampleCoroutine.
        StartCoroutine(ExampleCoroutine());
    }

    IEnumerator ExampleCoroutine()
    {
        //Print the time of when the function is first called.
        Debug.Log("Started Coroutine at timestamp : " + Time.time);

        //yield on a new YieldInstruction that waits for 5 seconds.
        yield return new WaitForSeconds(5);

        //After we have waited 5 seconds print the time again.
        Debug.Log("Finished Coroutine at timestamp : " + Time.time);
    }
Posted by: Guest on December-24-2020

Code answers related to "function that makes something wait for 3 seconds in unity"

C# Answers by Framework

Browse Popular Code Answers by Language