/// <summary> /// Constructor for AsyncTask. /// </summary> /// <param name="asyncOperationComplete">A callback that, when invoked, changes the status of the task to /// complete and sets the result based on the argument supplied.</param> internal AsyncTask(out Action <T> asyncOperationComplete) { // Register for early update event. if (!AsyncTask.IsInitialized) { AsyncTask.InitAsyncTask(); } IsComplete = false; asyncOperationComplete = delegate(T result) { this.Result = result; IsComplete = true; if (m_ActionsUponTaskCompletion != null) { AsyncTask.PerformActionInUpdate(() => { for (int i = 0; i < m_ActionsUponTaskCompletion.Count; i++) { m_ActionsUponTaskCompletion[i](result); } }); } }; }
/// @cond EXCLUDE_FROM_DOXYGEN /// <summary> /// Constructor for AsyncTask. /// </summary> /// <param name="asyncOperationComplete">A callback that, when invoked, changes the status of the task to /// complete and sets the result based on the argument supplied.</param> public AsyncTask(out Action <T> asyncOperationComplete) { IsComplete = false; asyncOperationComplete = delegate(T result) { this.Result = result; IsComplete = true; if (m_ActionsUponTaskCompletion != null) { AsyncTask.PerformActionInUpdate(() => { for (int i = 0; i < m_ActionsUponTaskCompletion.Count; i++) { m_ActionsUponTaskCompletion[i](result); } }); } }; }