Merge pull request #33 from LiuOcean/main

Update UniTask README Example
pull/35/head
何冠峰 2022-08-04 17:43:12 +08:00 committed by GitHub
commit 706e8601a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -8,13 +8,16 @@
## 代码示例 ## 代码示例
```csharp ```csharp
var handle = YooAssets.LoadAssetAsync<GameObject>("Assets/Res/Prefabs/TestImg.prefab"); public async UniTask Example(IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update)
{
var handle = YooAssets.LoadAssetAsync<GameObject>("Assets/Res/Prefabs/ TestImg.prefab");
await handle.ToUniTask(); await handle.ToUniTask(progress, timing);
var obj = handle.AssetObject as GameObject; var obj = handle.AssetObject as GameObject;
var go = Instantiate(obj, transform); var go = Instantiate(obj, transform);
go.transform.localPosition = Vector3.zero; go.transform.localPosition = Vector3.zero;
go.transform.localScale = Vector3.one; go.transform.localScale = Vector3.one;
}
``` ```