All I want to do is press space to run a function and then have it wait for space to be pressed again to continue. When I hit space I instantly see Waiting and Waited in the debug. It never waits. I saw lots of posts showing while loops in the IEnumerator but another post showing the yield return line I have there. Do I have to have a while loop or do I have something else wrong?
if (Input.GetKeyDown(KeyCode.Space))
{
RevealAnswers();
StartCoroutine(WaitForSpace());
}
IEnumerator WaitForSpace()
{
Debug.Log("Waiting");
yield return new WaitUntil(() => Input.GetKeyDown(KeyCode.Space));
Debug.Log("Waited");
}