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

Number#

  • Can Read

  • Cannot Write

Description#

A constant numeric value

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Inline(nameof(m_Value))]
    
    [Title("Number")]
    [Category("Number")]
    
    [Description("A constant numeric value")]
    [Image(typeof(IconNumber), ColorTheme.Type.Teal)]
    
    [Keywords("Value", "Float", "Double", "Decimal", "Integer", "Constant")]
    
    [Serializable]
    public class TypeNumberConstant : TypeNumber
    {
        [SerializeField] private double m_Value;

        public override double GetPreview(GameObject source) => this.m_Value;

        public TypeNumberConstant() : this(0f)
        { }
        
        public TypeNumberConstant(float value)
        {
            this.m_Value = value;
        }
        
        public TypeNumberConstant(double value)
        {
            this.m_Value = value;
        }

        public override double Get(Args args)
        {
            return this.m_Value;
        }

        public override string ToString()
        {
            return this.m_Value.ToString("0.##");
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnEditorChange;

    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.