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