Created
July 14, 2020 10:09
-
-
Save JotaroS/098a8d8322d9d3af8b7f3191780c8252 to your computer and use it in GitHub Desktop.
sample await
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
using UnityEngine; | |
using System.Threading.Tasks; | |
public class SampleAwait : MonoBehaviour | |
{ | |
public bool flag = false; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
MyTask(); | |
} | |
async void MyTask(){ | |
Debug.Log("waiting"); | |
while(!flag)await Task.Delay(100); | |
Debug.Log("waiting over"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment