Update README.md

pull/126/head
Yoshifumi Kawai 2020-08-05 15:55:09 +09:00 committed by GitHub
parent 08d5183e7e
commit c99d3eb3c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 14 deletions

View File

@ -154,9 +154,7 @@ UniTask provides three pattern of extension methods.
The type of `UniTask` can use utility like `UniTask.WhenAll`, `UniTask.WhenAny`. It is like Task.WhenAll/WhenAny but return type is more useful, returns value tuple so can deconsrtuct each result and pass multiple type. The type of `UniTask` can use utility like `UniTask.WhenAll`, `UniTask.WhenAny`. It is like Task.WhenAll/WhenAny but return type is more useful, returns value tuple so can deconsrtuct each result and pass multiple type.
```csharp ```csharp
public class SceneAssets public async UniTaskVoid LoadManyAsync()
{
public SceneAssets()
{ {
// parallel load. // parallel load.
var (a, b, c) = await UniTask.WhenAll( var (a, b, c) = await UniTask.WhenAll(
@ -170,7 +168,6 @@ public class SceneAssets
var resource = await Resources.LoadAsync<Sprite>(path); var resource = await Resources.LoadAsync<Sprite>(path);
return (resource as Sprite); return (resource as Sprite);
} }
}
``` ```
If you want to convert callback to UniTask, you can use `UniTaskCompletionSource<T>` that is the lightweight edition of `TaskCompletionSource<T>`. If you want to convert callback to UniTask, you can use `UniTaskCompletionSource<T>` that is the lightweight edition of `TaskCompletionSource<T>`.