master
neuecc 2020-06-08 01:50:20 +09:00
parent 680ce1098b
commit 79330d7cdb
1 changed files with 10 additions and 0 deletions

View File

@ -741,6 +741,16 @@ public class ZeroAllocAsyncAwaitInDotNetCore
}
}
}
// UniTask does not return to original SynchronizationContext but you can use helper `ReturnToCurrentSynchronizationContext`.
public ValueTask TestAsync()
{
await using (UniTask.ReturnToCurrentSynchronizationContext())
{
await UniTask.SwitchToThreadPool();
// do anything..
}
}
```
.NET Core version is intended to allow users to use UniTask as an interface when sharing code with Unity (such as [Cysharp/MagicOnion](https://github.com/Cysharp/MagicOnion/)). .NET Core version of UniTask enables smooth code sharing.