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

Perlin Noise 2D#

Math / Arithmetic / Perlin Noise 2D

  • Can Read

  • Cannot Write

Description#

Returns the result of feeding a Vector2 into a Perlin Noise function

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Perlin Noise 2D")]
    [Category("Math/Arithmetic/Perlin Noise 2D")]
    
    [Description("Returns the result of feeding a Vector2 into a Perlin Noise function")]
    [Image(typeof(IconNoise), ColorTheme.Type.Yellow, typeof(Badge2D))]
    
    [Keywords("Map", "Random")]
    
    [Serializable]
    public class TypeNumberMathPerlinNoise2D : TypeNumber
    {
        [SerializeField] private GetVector2 m_Vector = new GetVector2();

        public override double GetPreview(GameObject source) =>
            Mathf.PerlinNoise(
                this.m_Vector.GetPreview(source).x,
                this.m_Vector.GetPreview(source).y
            );

        public override double Get(Args args)
        {
            Vector2 vector = this.m_Vector.Get(args); 
            return Mathf.PerlinNoise(vector.x, vector.y);
        }

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