docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class OptimizeHeightRange

    Exposes functions for making the best available use of the heightmap range on a given terrain

    Inheritance
    object
    OptimizeHeightRange
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.TerrainTools
    Assembly: Unity.TerrainTools.Editor.dll
    Syntax
    public static class OptimizeHeightRange

    Methods

    GetTerrainHeightRange(out float, out float, params TerrainData[])

    Returns the minimum and maximum world height values for terrainDatas. The results are passed as out parameters.

    Declaration
    public static void GetTerrainHeightRange(out float minHeight, out float maxHeight, params TerrainData[] terrainDatas)
    Parameters
    Type Name Description
    float minHeight

    float (will be reset)

    float maxHeight

    float (will be reset)

    TerrainData[] terrainDatas

    One or more Terrain object

    OptimizeSelectedTerrains(float, float)

    Performs RemapTerrainHeights on the currently selected Terrain with a target efficiency of 95%

    Declaration
    public static void OptimizeSelectedTerrains(float padBottom = 0.025, float padTop = 0.025)
    Parameters
    Type Name Description
    float padBottom

    Padding added below the height range; 0 - 1, relative the total height.

    float padTop

    Padding added above the height range; 0 - 1, relative the total height.

    RemapSelectedTerrains(int, int)

    Remap selected terrain objects to use the specified height range.

    Unlike OptimizeSelectedTerrains this can be applied to multiple objects

    Declaration
    public static void RemapSelectedTerrains(int minY, int maxY)
    Parameters
    Type Name Description
    int minY

    The lower world-space bound of the intended height range

    int maxY

    The upper world-space bound of the intended height range

    RemapTerrainHeights(Terrain, int, int)

    Remap the heightmap pixels in a given Terrain so they completely fill a user-supplied range of heightmap values while preserving their current world positions. Heights outside the supplied range will be truncated to fit.

    Declaration
    public static void RemapTerrainHeights(Terrain targetTerrain, int heightMapMin, int heightMapMax)
    Parameters
    Type Name Description
    Terrain targetTerrain

    Terrain object to edit

    int heightMapMin

    The world Y coordinate of the new lower bound of the the target terrain

    int heightMapMax

    The world Y coordinate of the new upper bound of the the target terrain

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)