Skip to content

Instantly share code, notes, and snippets.

@kuanyingchou
Last active August 29, 2015 13:58
Show Gist options
  • Save kuanyingchou/10094901 to your computer and use it in GitHub Desktop.
Save kuanyingchou/10094901 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class TestWait : MonoBehaviour {
private bool hasTouched = false;
public IEnumerator Start() {
Debug.Log("1");
yield return StartCoroutine(WaitForInput());
Debug.Log("2");
}
public void OnTouchBegan() {
hasTouched = true;
Debug.Log("touched!");
}
public IEnumerator WaitForInput() {
while(!hasTouched) {
Debug.Log("waiting...");
yield return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment