# Terrain Sample Height

[Miscellaneous](../index.md) / [Terrain](index.md) / **Terrain Sample Height**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

Returns the execution of Sample Height method on the Terrain component

## Code

```cs
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Terrain Sample Height")]
    [Category("Miscellaneous/Terrain/Sample Height")]
    [Description("Returns the execution of Sample Height method on the Terrain component")]
    
    [Image(typeof(IconTerrain), ColorTheme.Type.Lime)]
    
    [Serializable]
    public class GenTypeNumber_Terrain_SampleHeight_1 : TypeNumber
    {
        [SerializeField] private GetGameObject m_Terrain = new GetGameObject(
            new GenTypeGameObject_Terrain()
        );
        
        [SerializeField] private GetVector3 m_WorldPosition = new GetVector3();
        
        public override double Get(Args args)
        {
            Terrain component = this.m_Terrain.Get<Terrain>(args);
            if (component == null) return default;
            
            double value = (double) component.SampleHeight(
                (Vector3) this.m_WorldPosition.Get(args)
            );
            
            return value;
        }
        
        public override string ToString()
        {
            return $"{this.m_Terrain} Sample Height ({this.m_WorldPosition})";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}


```

