Skip to content

Instantly share code, notes, and snippets.

@JotaroS
Created July 14, 2020 10:09
Show Gist options
  • Save JotaroS/098a8d8322d9d3af8b7f3191780c8252 to your computer and use it in GitHub Desktop.
Save JotaroS/098a8d8322d9d3af8b7f3191780c8252 to your computer and use it in GitHub Desktop.
sample await
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