IEnumerator Process() { if (progress) { progress.Begin(duration); } float startTime = Time.time; float percent = 0f; float elapsedTime = 0f; while (percent < 1f) { yield return(null); elapsedTime = Time.time - startTime; percent = elapsedTime / duration; Percent.Invoke(percent); } }