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