Happy Memorial Day! While today is a holiday, my goal today is to finish up a few posts. So today, I am going to speak to you about Coroutines in Unity.

Now if you use an if statement over and over, it becomes long and tedious. What if you can shorten it down to another block and text. Why not try IEnumerator? And what is IEnumerator do and how to use it?

IEnumerator is a function that allows you to call a long list of stuff and turn it off and on.

So to start with you will need to create a bool to access wiether to turn on and off the function. Then create IEnumerator to start the function and using while, so while everything is going on, this function will start and there is a line called yield return new WaitForSconds( placing in a float number); This spot will call for it to be able to wait for a short time and return to be able to be used instead of calling if /else statements a bunch of times.

Then you call in back in the Start and begin to see what is happening. This function allows you monitor a lot of boolean systems to help out.

So any questions??? Or comments please let me know.

Have a great day.

Game Designer and Unity Developer