private IEnumerator TaskCoroutine(Task <MGOutput> t) { while (!t.IsCompleted && !t.IsCanceled && !t.IsFaulted) { yield return(null); } result = t.Result; OnComplete(); }
private void CalculateAsync(bool ignoreDirty) { if (calculator != null && (ignoreDirty || !input.dirty) && CheckTimeBasedArrays() && CheckTHRBasedArrays()) { OnStart(); #if !UNITY_WEBGL || (UNITY_WEBGL && UNITY_SSM_WEBGL_THREADING_CAPABLE) var t = calculator.Calculate(input); StartCoroutine(TaskCoroutine(t)); #else result = calculator.Calculate(input).Result; OnComplete(); #endif } }