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;
}
}
}