Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Wait While#

Control / Wait While

Description#

Waits while a condition is true and continues the execution when false

Parameters#

Name Description
Conditions The conditions to check

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Wait While")]
    [Image(typeof(IconTimer), ColorTheme.Type.Blue, typeof(BadgeSync))]
    
    [Description("Waits while a condition is true and continues the execution when false")]
    [Category("Control/Wait While")]
    
    [Parameter("Conditions", "The conditions to check")]
    
    [Keywords("Hold", "Pause", "Yield")]
    
    [NestInnerList(nameof(m_Conditions))]
    
    [Serializable]
    public class InstructionCoreWaitWhile : Instruction
    {
        [SerializeField]
        private Conditions m_Conditions = new Conditions();

        protected override string GetTitle(GameObject source) => $"Wait while {this.m_Conditions}";

        protected override async Awaitable Run(Args args)
        {
            while (this.m_Conditions.Check(args, Conditions.DEFAULT_OPERATION))
            {
                await this.NextFrame();
            }
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.