using System; namespace UnityAsync { public struct WaitWhile : IAwaitInstruction { readonly Func condition; readonly TState state; bool IAwaitInstruction.IsCompleted() => !condition(state); /// /// Waits until the condition returns true before continuing. /// public WaitWhile(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; } } }