Co-routine on more than one KeyPress

Hi, I’m trying to wait for one of two key presses using a co-routine. However, I can’t figure out how I would listen for multiple key presses. This is the code I have so far. Only the While loop for the Alpha2 key is processed :/:

IEnumerator WaitForJoker()
    {
        while (!Input.GetKeyDown(KeyCode.Alpha1))
        {
            Counter_Manager.Script.currentCounterPlacementType = Counter_Manager.CounterPlacement.PlaceAnyCounter;
            yield return null;
        }
        while (!Input.GetKeyDown(KeyCode.Alpha2))
        {
            Counter_Manager.Script.currentCounterPlacementType = Counter_Manager.CounterPlacement.RemoveCounter;
            yield return null;
        }
    }

I hope somone can help. Thanks!

You can ask multiple questions as arguments in a while loop (or for that matter in an if-statement), using, for example, && or ||. If you say

 while(statement1 || statement2){
    //code to run if true
}

the code will run while statement1 OR statement2 is true.
If you write

 while(statement1 && statement2){
    //code to run if true
}

the core will runt while BOTH are true.

The code you have right now will run “Counter_Manager.Script.currentCounterPlacementType = Counter_Manager.CounterPlacement.PlaceAnyCounter;” every frame, until you press Alpha1. Then it will run “Counter_Manager.Script.currentCounterPlacementType = Counter_Manager.CounterPlacement.RemoveCounter;” every frame, until alpha2 is pressed. Then it will terminate the IEnumerator.

Is this really what you wanted to do?