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

Absolute#

Math / Arithmetic / Absolute

  • Can Read

  • Cannot Write

Description#

Returns the absolute value of the number

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Absolute")]
    [Category("Math/Arithmetic/Absolute")]
    
    [Description("Returns the absolute value of the number")]
    [Image(typeof(IconAbsolute), ColorTheme.Type.Yellow)]
    
    [Keywords("Sign", "Positive")]
    
    [Serializable]
    public class TypeNumberMathAbsolute : TypeNumber
    {
        [SerializeField] private GetNumber m_Number = new GetNumber();

        public override double GetPreview(GameObject source) => Math.Abs(this.m_Number.GetPreview(source));

        public override double Get(Args args)
        {
            double number = this.m_Number.Get(args);
            return Math.Abs(number);
        }

        public override string ToString()
        {
            return $"|{this.m_Number}|";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.