Understanding Coroutines in Unity using C#

Chelsea Cruise
Aug 25, 2021

I will demonstrate a delay timer & I will showing the results in the console.

First off, create an empty game object and call it Timer.

Now create a C# script — call it whatever you’d like — I’m calling mine ‘Clock’.

In the script, I’ll start by creating an IEnumerator called Delay.

Next we’ll add in our yield return statement along with a debug.log to test it out. Make sure to call it in your start method.

Now after 3 seconds, our string is displayed in the console.

--

--

Chelsea Cruise

Unity Developer, Software Engineer, Game Designer, Graphic Artist