So after doing some reading and checking out everyone else’s code, I’m still unsure of how a co-routine should be constructed. I noticed many people do this with a while loop. But I have a for loop that I would like to do this with, I need it to stop at the if statement and check to see what the user pressed. Suggestions?
void LetterChecker() {
for (int i = 0; i < gCharArray.Length; i++) {
string charHolder = gCharArray*.ToString();*
if (Input.GetKeyDown(charHolder)) { print(charHolder);
This is basically one of the easiest way to make use of co-routine written in C#:
IEnumerator YourCoroutineName(){
// Your code that you want here
// In this case is the for function
}
void YourFunctionName(){
StartCoroutine("YourCoroutineName");
}
Of how to wait until the user to type then why don’t you try while loop, may be it’s the best and common way to use. Myself don’t have any suggestion for this issue.