YarnTaskCompletionSource
public class YarnTaskCompletionSourceInherits from System.Object
The main use of this class is to be able to provide a Yarn Task that can be awaited like any other, but have it's completion set not by having a method that finishes, but by an external factor. Essentially this allows non-async code to create a facade of asynchronicity without changing their underlying implementation significantly.
Used in many different places one of the main uses of this is to allow the Unity UI and Input systems to use a callback to set an option as selected as they expect. These callbacks then use this class to make and complete a task that the rest of Yarn Spinner can await like normal. This allows the Dialogue Presenter to think as everything as being async and allows the UI to think in terms of callbacks, each gets to work how they prefer.
This is the Yarn Task form of the Task/Awaitable/UniTask TaskCompletionSource classes.
Similar to YarnTask itself we recommend that where possible you use your underlying awaiter infrastructures equivalents of this class in preference to this class.
See also
#Properties
#Task
public YarnTask Task { get }Type YarnTask
#Methods
#TrySetCanceled()
public partial bool TrySetCanceled();Returns Boolean
#TrySetException(System.Exception)
public partial bool TrySetException(System.Exception exception);Parameters
exceptionException
Returns Boolean
#TrySetResult()
public partial bool TrySetResult();Returns Boolean
Generated from Yarn Spinner for Unity 3.3.