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

Exit#

Control / Exit

Description#

Exits the execution sequence if the conditions are met

Parameters#

Name Description
Conditions The conditions to check

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Exit")]
    [Image(typeof(IconReturn), ColorTheme.Type.Red)]
    
    [Description("Exits the execution sequence if the conditions are met")]
    [Category("Control/Exit")]
    
    [Parameter("Conditions", "The conditions to check")]
    
    [Keywords("Return", "Early", "Exit", "Break")]
    
    [NestInnerList(nameof(m_Conditions))]
    
    [Serializable]
    public class InstructionCoreReturn : Instruction
    {
        [SerializeField] private Conditions m_Conditions = new Conditions();

        protected override string GetTitle(GameObject source) =>
            this.m_Conditions.IsEmpty
                ? "Exit"
                : $"Exit if {this.m_Conditions}";

        protected override Awaitable Run(Args args)
        {
            if (this.m_Conditions.Check(args, Conditions.DEFAULT_OPERATION))
            {
                this.CurrentResult = InstructionResult.Exit;
            }
            
            return Done;
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.