RunOnMainThread() public static method

Schedules the action to run on the main thread
public static RunOnMainThread ( System.Action action ) : void
action System.Action
return void
コード例 #1
0
        /// <summary>
        /// Executes the task on the main thread
        /// </summary>
        protected void RunOnMainThread()
        {
            Status = TaskStatus.Running;
#if UNITY_WEBGL
            Execute();
#else
            TaskManager.RunOnMainThread(Execute);
#endif
        }
コード例 #2
0
        /// <summary>
        /// Creates a new background Task strategy
        /// </summary>
        /// <param name="function"></param>
        public UnityTask(Func <TResult> function)
            : this()
        {
            if (function == null)
            {
                throw new ArgumentNullException("function");
            }

            _function = function;
            Status    = TaskStatus.Running;
#if UNITY_WEBGL
            Execute();
#else
            TaskManager.RunOnMainThread(Execute);
#endif
        }
コード例 #3
0
        /// <summary>
        /// Creates a new background Task strategy
        /// </summary>
        public UnityTask(Delegate function, object param)
            : this()
        {
            if (function == null)
            {
                throw new ArgumentNullException("function");
            }

            _function2 = function;
            Paramater  = param;
            Status     = TaskStatus.Running;
#if UNITY_WEBGL
            Execute();
#else
            TaskManager.RunOnMainThread(Execute);
#endif
        }
コード例 #4
0
 protected void RunOnMainThread()
 {
     Status = TaskStatus.Pending;
     TaskManager.RunOnMainThread(Execute);
 }