public static void SubmitWork(Func <IEnumerator <ProgressReport> > workFunc) { // Hook up the progress behavior to ProgressBar_Slider; GameObject progressBarSliderGO = GameObject.Find("ProgressBar_Slider"); if (progressBarSliderGO != null) { ProgressBarLoadingBehavior progressBarLoadingBehavior = progressBarSliderGO.GetComponent <ProgressBarLoadingBehavior>(); progressBarLoadingBehavior.SubmitWork(workFunc); } else { Logger.Log("ProgressPanel not found: Performing work on current thread"); IEnumerator <ProgressReport> workEnumerator = workFunc.Invoke(); while (workEnumerator.MoveNext()) { // do nothing -- drain the enumeration -- complete the work on this thread immediately } } }
internal static void SubmitWork(Func <IEnumerator <ProgressReport> > workFunc) { LoadingBehavior.SubmitWork(workFunc); }