Try this
void Function()
{
while (condition)
{
await Task.Delay(1);
}
}
This will make the program wait until the condition is not true. You can just invert it by adding a "!" infront of the condition so that it will wait until the condition is true.