Car/Assets/Plugin/YogiGameCore/UniTask/Runtime/UnityAsyncExtensions.MonoBe...

14 lines
422 B
C#
Raw Normal View History

2024-12-31 07:57:41 +08:00
using System;
using System.Threading;
namespace Cysharp.Threading.Tasks
{
public static partial class UnityAsyncExtensions
{
public static UniTask StartAsyncCoroutine(this UnityEngine.MonoBehaviour monoBehaviour, Func<CancellationToken, UniTask> asyncCoroutine)
{
var token = monoBehaviour.GetCancellationTokenOnDestroy();
return asyncCoroutine(token);
}
}
}