Skip to content

Instantly share code, notes, and snippets.

@kyubuns
Created May 17, 2020 07:11
Show Gist options
  • Save kyubuns/3b9d6559c84cacdf4543eb50b1875a5f to your computer and use it in GitHub Desktop.
Save kyubuns/3b9d6559c84cacdf4543eb50b1875a5f to your computer and use it in GitHub Desktop.
var hoge = new[] { 1, 2, 3 };
Debug.Log($"hoge = {string.Join(", ", hoge)}");
await hoge.ToUniTaskAsyncEnumerable().SelectAwait(async x =>
{
var delay = Random.Range(0.0f, 1.0f);
Debug.Log($"x = {x}, Delay = {delay}");
await UniTask.Delay(TimeSpan.FromSeconds(delay));
return new { Before = x, After = x + 1 };
}).ForEachAwaitAsync(async x =>
{
Debug.Log($"Before = {x.Before}, After = {x.After}");
await UniTask.Delay(TimeSpan.FromSeconds(1));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment