/** * Use during Update by calling StartCoroutine(timerName.DoTimer()); */ public IEnumerator DoTimer() { timeWaited += Time.deltaTime; while (timeWaited < timeToWait) { yield return(null); } if (!callbackFunc.Equals(null)) { callbackFunc(); } timeWaited = 0; }