Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. //코루틴 A
  2. IEnumerator CoroutineA()
  3. {
  4. Debug.Log("start A");
  5. yield return new WaitForSeconds(3.0f);
  6. Debug.Log("finish A");
  7. }
  8. //코루틴 B
  9. IEnumerator CoroutineB()
  10. {
  11. Debug.Log("start B");
  12. yield return new WaitForEndOfFrame();
  13. Debug.Log("finish B");
  14. }
  15.  
  16. // 코루틴A 가 종료된 후 이어서 코루틴B 를 실행한다.
  17. var cancel = Observable.FromCoroutine(CoroutineA)
  18. .SelectMany(CoroutineB) //SelectMany : 다른 스트림으로 교체
  19. .Subscribe("Subscribe!");
  20.  
  21. //Dispose 를 호출하 코루틴을 중단할 수 있다.
  22. //cancel.Dispose();
  23.  
  24. //---결과---//
  25. start A
  26. finish A
  27. start B
  28. finish B
  29. Subscribe!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement