---
tags:
    - "Value"
    - "Float"
    - "Double"
    - "Decimal"
    - "Integer"
    - "Constant"
---

# Number

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

A constant numeric value

## Code

```cs
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;

    }
}
```

