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

Subtract Number#

Math / Arithmetic / Subtract Number

Description#

Decreases a numeric value by a given amount

Parameters#

Name Description
Set The value that is decremented
Value The amount to decrement

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Subtract Number")]
    [Image(typeof(IconMinusCircle), ColorTheme.Type.Teal)]
    
    [Description("Decreases a numeric value by a given amount")]
    [Category("Math/Arithmetic/Subtract Number")]
    
    [Parameter("Set", "The value that is decremented")]
    [Parameter("Value", "The amount to decrement")]
    
    [Keywords("Set", "Change", "Modify", "-", "Minus", "Rest", "Subtract", "Decrease", "Decrement")]
    [Keywords("Int", "Integer", "Float", "Value", "Decimal")]
    
    [Serializable]
    public class InstructionCoreMathNumberSubtract : Instruction
    {
        [SerializeField] private SetNumber m_Set = new SetNumber();
        [SerializeField] private GetNumber m_Value = new GetNumber();

        protected override string GetTitle(GameObject source) => $"{this.m_Set} - {this.m_Value}";

        protected override Awaitable Run(Args args)
        {
            double current = this.m_Set.Get(args);
            double value = this.m_Value.Get(args);
            
            this.m_Set.Set(current - value, args);
            return Done;
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.