public IEnumerator AssignKey(string keyName) // This actually does the assignment and starts the checking for key presses { isWaiting = true; // this sets it to start checking for key presses Debug.Log("assigning.."); yield return(WaitForKey()); // runs endlessly till key pressed if (newKey == default(KeyCode)) { yield return(null); } else { validKey = true; KeyBinding.ChangeKey(keyName, newKey); Debug.Log("Finished! New Key = " + newKey.ToString()); } yield return(null); }