Using a coroutine to wait for a button press?

One of the items in the game I’m working on allows you to control the wind. The way it works is you press a button to select the wind power, then the game should continue as normal while it waits for you to specify what direction you want the wind to go in. I figured a coroutine would be the best way of going about it, but for some reason once one of the directional buttons is pressed, the coroutine ends without changing the wind direction. Any help would be greatly appreciated!

	IEnumerator Wind(){

		do {

				windDir = new Vector3(10*Input.GetAxis("Horizontal"),0,0);
				isWindy = true;
				windDir = new Vector3(0,0,10*Input.GetAxis ("Vertical"));
				isWindy = true;

			yield return null;
		} while (!Input.GetButtonDown("Horizontal") && !Input.GetButtonDown("Vertical"));


Not sure a coroutine is the best place to check for buttons. Seems too easy to double-read the same button in the normal Update check.

For yours, look at the loop structure. The end and the beginning of all loops always touch. So yours waits for a frame (the yield), quits if a button was pressed, then would process the button. Move the yield to the start of the loop?

But, GetAxis ramps up for how long the button was held. Checking it immediately after the button goes down will give a value close to 0. Unless they held it for a while, let go, and pressed it quickly before it drops much. Seems like maybe you want to wait until they release it, then check getAxis.