Created
May 17, 2020 07:11
-
-
Save kyubuns/3b9d6559c84cacdf4543eb50b1875a5f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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