You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

14 lines
422 B

  1. using System;
  2. using System.Threading;
  3. namespace Cysharp.Threading.Tasks
  4. {
  5. public static partial class UnityAsyncExtensions
  6. {
  7. public static UniTask StartAsyncCoroutine(this UnityEngine.MonoBehaviour monoBehaviour, Func<CancellationToken, UniTask> asyncCoroutine)
  8. {
  9. var token = monoBehaviour.GetCancellationTokenOnDestroy();
  10. return asyncCoroutine(token);
  11. }
  12. }
  13. }