Example #1
0
        /// <summary>
        /// Registers a continuation for the task that will run when the task is complete.
        /// </summary>
        /// <typeparam name="T">The type returned by the continuation.</typeparam>
        /// <param name="p_continuation">The continuation to run after the task completes.
        /// The function takes the completed task as an argument and can return a value.</param>
        /// <param name="p_cancellationToken">The cancellation token.</param>
        /// <returns>A new Task that returns the value returned by the continuation after both
        /// the task and the continuation are complete.</returns>
        public UnityTask <UnityTask> ContinueWith(Func <UnityTask, IEnumerator> p_continuation, System.Threading.Tasks.CancellationToken p_cancellationToken)
        {
            Func <UnityTask, UnityTask> continuation = t =>
            {
                return(UnityTask.Run(() => p_continuation(t)));
            };

            return(ContinueWith(continuation, p_cancellationToken));
        }