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

Square Root#

Math / Arithmetic / Square Root

  • Can Read

  • Cannot Write

Description#

Returns the square root of a number

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Square Root")]
    [Category("Math/Arithmetic/Square Root")]
    
    [Description("Returns the square root of a number")]
    [Image(typeof(IconSqrt), ColorTheme.Type.Yellow)]
    
    [Keywords("Sqrt")]
    
    [Serializable]
    public class TypeNumberMathSqrt : TypeNumber
    {
        [SerializeField] private GetNumber m_Number = new GetNumber();

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

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

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