Update UniTask README Example

pull/33/head
L 2022-08-03 23:34:18 +08:00
parent 7e6c678e91
commit 216949d7a5
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;
}
``` ```