public ManualAwaiter GetAwaiter() { ManualAwaiter awaiter = new ManualAwaiter(); if (ContextHelper.IsMainThread) { RoutineHelper.Instance.StartCoroutine(WaitOneFrameAndRunContinuationRoutine(awaiter)); } else { ContextHelper.UnitySynchronizationContext.Post((state) => { awaiter.RunContinuation(); }, null); } return(awaiter); }
private IEnumerator WaitOneFrameAndRunContinuationRoutine(ManualAwaiter awaiter) { yield return(null); awaiter.RunContinuation(); }