using System; namespace UnityAsync { public struct WaitUntil : IAwaitInstruction { readonly Func condition; bool IAwaitInstruction.IsCompleted() => condition(); /// /// Waits until the condition returns true before continuing. /// public WaitUntil(Func condition) { #if UNITY_EDITOR if(condition == null) throw new ArgumentNullException(nameof(condition), "This check only occurs in edit mode."); #endif this.condition = condition; } } }