Skip to content

Instantly share code, notes, and snippets.

@zyouyowa
Created September 22, 2017 06:18
Show Gist options
  • Save zyouyowa/ce5d6f5f97f735b1dc98042e2cdff262 to your computer and use it in GitHub Desktop.
Save zyouyowa/ce5d6f5f97f735b1dc98042e2cdff262 to your computer and use it in GitHub Desktop.
UnityのWaitWhileでループを作れるっぽい
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