YarnTask
public partial struct YarnTaskInherits from System.ValueType
In Unity there are many different possible Awaiter types you could be making use of. Depending on your Unity set up the Yarn Task will wrap and forward any async behaviour into:
- Cysharp.Threading.Tasks.UniTask
- UnityEngine.Awaitable
- System.Threading.Tasks.Task
In general we recommend that you use the underlying awaiter instead of Yarn Task. Yarn Task exists primarily so that we don't have to wrap all our code and samples inside ifdefs and usings. As such it has only the minimum features needed to play the role of forwarding async calls. There are many quality of life features that the underlying awaiters have that we've not implemented because we don't need them for this job.
#Properties
#CompletedTask
public static YarnTask CompletedTask { get }Type YarnTask
#Methods
#Delay(int, CancellationToken)
timeSpan, and then returns.public static YarnTask Delay(int milliseconds, CancellationToken token = default);Parameters
timeSpan(unknown)The amount of time to wait.tokenCancellationTokenA token that can be used to cancel the task.millisecondsintThe amount of time to wait.
#Delay(TimeSpan, CancellationToken)
timeSpan, and then returns.public static partial YarnTask Delay(TimeSpan timeSpan, CancellationToken token = default);Parameters
timeSpanTimeSpanThe amount of time to wait.tokenCancellationTokenA token that can be used to cancel the task.
#Forget()
readonly public async void Forget()#FromResult<T>(T)
public static YarnTask<T> FromResult<T>(T value);Parameters
valueT
Returns YarnTask
#GetAwaiter()
public TaskAwaiter GetAwaiter();Returns TaskAwaiter
#IsCompleted()
readonly public bool IsCompleted();Returns Boolean
#IsCompletedSuccessfully()
readonly public bool IsCompletedSuccessfully();Returns Boolean
#SuppressCancellationThrow()
public readonly partial YarnTask<bool> SuppressCancellationThrow();Returns YarnTask
#ToCoroutine(Func<YarnTask>)
public static partial IEnumerator ToCoroutine(Func<YarnTask> factory);Parameters
factoryFunc<Yarn.Unity.YarnTask>
Returns IEnumerator
#WaitForAsyncOperation(AsyncOperationHandle, CancellationToken)
public static partial YarnTask WaitForAsyncOperation(AsyncOperationHandle operationHandle, CancellationToken cancellationToken);Parameters
operationHandleAsyncOperationHandlecancellationTokenCancellationToken
Returns YarnTask
#WaitForAsyncOperation<T>(AsyncOperationHandle<T>, CancellationToken)
public static partial YarnTask<T> WaitForAsyncOperation<T>(AsyncOperationHandle<T> operationHandle, CancellationToken cancellationToken);Parameters
operationHandleAsyncOperationHandle<T>cancellationTokenCancellationToken
Returns YarnTask
#WaitUntil(System.Func<bool>, System.Threading.CancellationToken)
public static partial YarnTask WaitUntil(System.Func<bool> predicate, System.Threading.CancellationToken token = default);Parameters
predicateFunc<bool>tokenCancellationToken
Returns YarnTask
#WaitUntilCanceled(System.Threading.CancellationToken)
public static partial YarnTask WaitUntilCanceled(System.Threading.CancellationToken token);Parameters
tokenCancellationToken
Returns YarnTask
#WhenAll(IEnumerable<YarnTask>)
public static partial YarnTask WhenAll(IEnumerable<YarnTask> tasks);Parameters
tasksIEnumerable<Yarn.Unity.YarnTask>
Returns YarnTask
#WhenAll(YarnTask[])
#WhenAll<T>(IEnumerable<YarnTask<T>>)
public static partial YarnTask<T[]> WhenAll<T>(IEnumerable<YarnTask<T>> tasks);Parameters
tasksIEnumerable<Yarn.Unity.YarnTask<T>>
Returns YarnTask
#WhenAll<T>(YarnTask<T>[])
public static partial YarnTask<T[]> WhenAll<T>(params YarnTask<T>[] tasks);Parameters
tasksYarn.Unity.YarnTask<T>[]
Returns YarnTask
#Yield()
public static partial YarnTask Yield();Returns YarnTask
Generated from Yarn Spinner for Unity 3.3.