Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public class SomeUtility {
  2. public bool IsDoingSomething { get; private set; }
  3.  
  4. public IEnumerator DoSomethingAsync() {
  5. IsDoingSomething = true;
  6. yield return new WaitForSeconds(2);
  7. IsDoingSomething = false;
  8. }
  9. }
  10.  
  11. while(!someUtilityInstance.IsDoingSomething)
  12. yield return null;
  13.  
  14. public static IEnumerator Await(this AsyncOperation operation) {
  15. while(!operation.isDone)
  16. yield return operation;
  17. }
  18.  
  19. yield return SceneManager.LoadLevelAsync("blaaaah").Await();
  20.  
  21. yield return StartCoroutine(yourIEnumatorMethod());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement