---
tags:
    - "Shader"
    - "Global"
    - "Material"
    - "Property"
    - "Value"
---

# Shader Global Float

[Rendering](../index.md) / [Shader](index.md) / **Shader Global Float**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :green_circle: Can Write

</div>

## Description

A float property shared by every shader that reads it and no material overrides

## Parameters

| Name | Description |
| :--- | :---------- |
| Property | The name of the global shader property |

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get, Set]

    [Title("Shader Global Float")]
    [Category("Rendering/Shader/Global Float")]

    [Description("A float property shared by every shader that reads it and no material overrides")]
    [Image(typeof(IconShader), ColorTheme.Type.Yellow)]

    [Parameter("Property", "The name of the global shader property")]

    [Keywords("Shader", "Global", "Material", "Property", "Value")]

    [Serializable]
    public class TypeNumberShaderGlobalFloat : TypeNumber
    {
        [SerializeField] private GetString m_Property = new GetString();

        public override double Get(Args args)
        {
            string property = this.m_Property.Get(args);
            return string.IsNullOrEmpty(property) ? 0 : Shader.GetGlobalFloat(property);
        }

        public override void Set(double value, Args args)
        {
            string property = this.m_Property.Get(args);
            if (string.IsNullOrEmpty(property)) return;

            Shader.SetGlobalFloat(property, (float) value);
        }

        public override string ToString()
        {
            return $"Shader Global {this.m_Property}";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
```

