Created
September 22, 2017 06:18
-
-
Save zyouyowa/ce5d6f5f97f735b1dc98042e2cdff262 to your computer and use it in GitHub Desktop.
UnityのWaitWhileでループを作れるっぽい
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Start () { | |
StartCoroutine (WaitWhileExperiment ()); | |
} | |
IEnumerator WaitWhileExperiment(){ | |
int a = 0; | |
yield return new WaitWhile (() => { | |
a++; | |
Debug.Log(a); | |
return a < 10; | |
}); | |
Debug.Log ("End"); | |
} | |
/* Output: | |
* 1 | |
* 2 | |
* 3 | |
* 4 | |
* 5 | |
* 6 | |
* 7 | |
* 8 | |
* 9 | |
* 10 | |
* End | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment