You cannot 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
C#
14 lines
422 B
C#
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);
|
|
}
|
|
}
|
|
} |