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

Clear Variable#

Variables / Clear Variable

Description#

Clears all values of a variable

Parameters#

Name Description
Variable The variable to be cleared

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Clear Variable")]
    [Image(typeof(IconVariable), ColorTheme.Type.TextLight, typeof(BadgeCross))]
    
    [Description("Clears all values of a variable")]
    [Category("Variables/Clear Variable")]
    
    [Parameter("Variable", "The variable to be cleared")]
    
    [Keywords("Variable", "Clear", "Clean", "Remove", "Wipe")]
    
    [Serializable]
    public class InstructionCoreVariableClear : Instruction
    {
        [SerializeField] private GetVariable m_Variable = new GetVariable();

        protected override string GetTitle(GameObject source) => $"Clear {this.m_Variable}";

        protected override Awaitable Run(Args args)
        {
            this.m_Variable.Get(args)?.Clear();
            return Done;
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.