UniTask/Assets/UniRx.Async/UnityAsyncExtensions.MonoBe...

14 lines
409 B
C#
Raw Normal View History

2020-04-26 01:38:16 +08:00
using System;
using System.Threading;
namespace UniRx.Async
{
public static partial class UnityAsyncExtensions
{
public static void StartAsyncCoroutine(this UnityEngine.MonoBehaviour monoBehaviour, Func<CancellationToken, UniTask> asyncCoroutine)
{
var token = monoBehaviour.GetCancellationTokenOnDestroy();
asyncCoroutine(token).Forget();
}
}
}