issue is as follows. I'm making a variant of a typing game, my issue is that I need to loop through my char array and check to see if the user is hitting the right key or not (introducing the requirement to wait for user input). When the right key is pressed, I need the while loop to stop and go back to the for loop and start over. But when I yield return, it exits both loops and I get Unreachable Code Detected.
I know this means that the for loop can't go through the rest of its iterations.. So where do I yield/return?
IEnumerator TestMyCoroutine() {
for (int i = 0; i < gCharArray.Length; i++) {
string charHolder = gCharArray[i].ToString();
while (true) {
if (Input.anyKeyDown) {
if (Input.GetKeyDown(charHolder)) {
} else {
print("Wrong Letter");
}
print(charHolder);
}
yield return null;
}
}
print("Word Typing Ended");
}