Esempio n. 1
0
        /// <summary>
        /// Runs the specified work on a new thread and returns a UnityTask object that represents the work
        /// </summary>
        /// <typeparam name="TResult">The return type of the UnityTask</typeparam>
        /// <param name="action">The work to execute asynchronously</param>
        /// <returns>A UnityTask object that represents the work to be run on a new thread</returns>
        public static UnityTask <TResult> Run <TResult>(Func <TResult> action)
        {
            UnityTask <TResult> unityTask = new UnityTask <TResult>(action);

            unityTask.Start();

            return(unityTask);
        }
Esempio n. 2
0
        /// <summary>
        /// Runs the specified work on a new thread and returns a UnityTask object that represents the work
        /// </summary>
        /// <param name="action">The work to execute asynchronously</param>
        /// <returns>A UnityTask object that represents the work to be run on a new thread</returns>
        public static UnityTask Run(Action action)
        {
            UnityTask unityTask = new UnityTask(action);

            unityTask.Start();

            return(unityTask);
        }