docs.unity3d.com
    Show / Hide Table of Contents

    Class Utility

    Provides utility methods for Terrain.

    Inheritance
    Object
    Utility
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEditor.TerrainTools
    Syntax
    public static class Utility

    Methods

    AnimationCurveToRenderTexture(AnimationCurve, ref Texture2D)

    Converts data from a AnimationCurve into a Texture2D

    Declaration
    public static Vector2 AnimationCurveToRenderTexture(AnimationCurve curve, ref Texture2D tex)
    Parameters
    Type Name Description
    AnimationCurve curve

    The AnimationCurve to convert from.

    Texture2D tex

    The Texture2D to convert data into.

    Returns
    Type Description
    Vector2

    Returns the range of the AnimationCurve.

    CollectTexelValidity(Terrain, Rect, Int32)

    Retrieves texel context data used for checking texel validity.

    Declaration
    public static PaintContext CollectTexelValidity(Terrain terrain, Rect boundsInTerrainSpace, int extraBorderPixels = 0)
    Parameters
    Type Name Description
    Terrain terrain
    Rect boundsInTerrainSpace
    Int32 extraBorderPixels
    Returns
    Type Description
    PaintContext

    Returns the PaintContext object used for checking texel validity.

    GenerateAndSetFilterRT(IBrushUIGroup, IBrushRenderUnderCursor, RenderTexture, Material)

    Sets and Generates the filter RenderTexture for transformation brushes and bind the texture to the provided Material. Note: Using this method will enable the Terrain Layer filter

    Declaration
    public static void GenerateAndSetFilterRT(IBrushUIGroup commonUI, IBrushRenderUnderCursor brushRender, RenderTexture destinationRenderTexture, Material mat)
    Parameters
    Type Name Description
    IBrushUIGroup commonUI

    The brush's commonUI group.

    IBrushRenderUnderCursor brushRender

    The brushRender object used for acquiring the heightmap and splatmap texture to blit from.

    RenderTexture destinationRenderTexture

    The RenderTexture designated as the destination.

    Material mat

    The Material to update.

    See Also
    FilterStack
    FilterContext

    GenerateAndSetFilterRT(IBrushUIGroup, RenderTexture, RenderTexture, Material)

    Generate the filter render texture for transformation brushes and bind the texture to the provided Material Sets and Generates the filter RenderTexture for transformation brushes and bind the texture to the provided Material.

    Declaration
    public static void GenerateAndSetFilterRT(IBrushUIGroup commonUI, RenderTexture sourceRenderTexture, RenderTexture destinationRenderTexture, Material mat)
    Parameters
    Type Name Description
    IBrushUIGroup commonUI

    The brush's commonUI group.

    RenderTexture sourceRenderTexture

    The RenderTexture designated as the source.

    RenderTexture destinationRenderTexture

    The RenderTexture designated as the destination.

    Material mat

    The Material to update.

    See Also
    FilterStack
    FilterContext

    GetDefaultPreviewMaterial(Boolean)

    Retrieves the default preview Material for painting on Terrains.

    Declaration
    public static Material GetDefaultPreviewMaterial(bool filtersPreviewEnabled = false)
    Parameters
    Type Name Description
    Boolean filtersPreviewEnabled

    Whether the filter preview is enabled.

    Returns
    Type Description
    Material

    Returns Terrain painting's default preview Material.

    GetPaintHeightMaterial()

    Gets the paint height material to render builtin brush passes.

    Declaration
    public static Material GetPaintHeightMaterial()
    Returns
    Type Description
    Material

    Material with the Paint Height shader

    Remarks

    This material overrides the Builtin PaintHeight shader with Terrain Tools version of PaintHeight. See TerrainBuiltinPaintMaterialPasses for the available passes to choose from. See "/com.unity.terrain-tools/Shaders/PaintHeight.shader" for the override PaintHeight shader.

    SetMaterialKeyword(Material, String, Boolean)

    Enable or disable the keyword for the provided Material instance

    Declaration
    public static void SetMaterialKeyword(Material mat, string keyword, bool enabled)
    Parameters
    Type Name Description
    Material mat

    The material to set.

    String keyword

    The keyword to enable and disable.

    Boolean enabled

    Whether to enable or disable the keyword of the material.

    SetupMaterialForPainting(PaintContext, BrushTransform, Material)

    Prepares the passed in Material for painting on Terrains.

    Declaration
    public static void SetupMaterialForPainting(PaintContext paintContext, BrushTransform brushTransform, Material material)
    Parameters
    Type Name Description
    PaintContext paintContext

    The painting context data.

    BrushTransform brushTransform

    The brush's transformation data.

    Material material

    The material being used for painting on Terrains.

    See Also
    PaintContext
    BrushTransform

    SetupMaterialForPaintingWithTexelValidityContext(PaintContext, PaintContext, BrushTransform, Material)

    Prepares the passed in Material for painting on Terrains while checking for Texel Validity.

    Declaration
    public static void SetupMaterialForPaintingWithTexelValidityContext(PaintContext paintContext, PaintContext texelCtx, BrushTransform brushTransform, Material material)
    Parameters
    Type Name Description
    PaintContext paintContext

    The painting context data.

    PaintContext texelCtx

    The texel context data.

    BrushTransform brushTransform

    The brush's transformation data.

    Material material

    The material being used for painting on Terrains.

    See Also
    PaintContext
    BrushTransform
    Back to top
    Copyright © 2023 Unity Technologies
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on Friday, November 3, 2023