docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TextureGradient

    A wrapper around Gradient to automatically bake it into a texture.

    Inheritance
    object
    TextureGradient
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Rendering
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    [Serializable]
    public class TextureGradient : IDisposable

    Constructors

    TextureGradient(Gradient)

    Creates a new TextureGradient from an existing Gradient.

    Declaration
    public TextureGradient(Gradient baseCurve)
    Parameters
    Type Name Description
    Gradient baseCurve

    The source Gradient.

    TextureGradient(GradientColorKey[], GradientAlphaKey[], GradientMode, ColorSpace, int, bool)

    Creates a new TextureCurve from an arbitrary number of keyframes.

    Declaration
    public TextureGradient(GradientColorKey[] colorKeys, GradientAlphaKey[] alphaKeys, GradientMode mode = GradientMode.PerceptualBlend, ColorSpace colorSpace = ColorSpace.Uninitialized, int requestedTextureSize = -1, bool precise = false)
    Parameters
    Type Name Description
    GradientColorKey[] colorKeys

    An array of keyframes used to define the color of gradient.

    GradientAlphaKey[] alphaKeys

    An array of keyframes used to define the alpha of gradient.

    GradientMode mode

    Indicates the color space that the gradient color keys are using.

    ColorSpace colorSpace

    Controls how the gradient colors are interpolated.

    int requestedTextureSize

    Texture Size used internally, if '-1' using Nyquist-Shannon limits.

    bool precise

    if precise uses 4Nyquist-Shannon limits, 2 otherwise.

    Fields

    colorSpace

    Indicates the color space that the gradient color keys are using.

    Declaration
    [SerializeField]
    [HideInInspector]
    public ColorSpace colorSpace
    Field Value
    Type Description
    ColorSpace

    mode

    Controls how the gradient colors are interpolated.

    Declaration
    [SerializeField]
    [HideInInspector]
    public GradientMode mode
    Field Value
    Type Description
    GradientMode

    Properties

    alphaKeys

    All alpha keys defined in the gradient.

    Declaration
    [HideInInspector]
    public GradientAlphaKey[] alphaKeys { get; }
    Property Value
    Type Description
    GradientAlphaKey[]

    colorKeys

    All color keys defined in the gradient.

    Declaration
    [HideInInspector]
    public GradientColorKey[] colorKeys { get; }
    Property Value
    Type Description
    GradientColorKey[]

    textureSize

    Texture Size computed.

    Declaration
    public int textureSize { get; }
    Property Value
    Type Description
    int

    Methods

    Dispose()

    Cleans up the internal texture resource.

    Declaration
    public void Dispose()

    Evaluate(float)

    Evaluate a time value on the Gradient.

    Declaration
    public Color Evaluate(float time)
    Parameters
    Type Name Description
    float time

    The time within the Gradient you want to evaluate.

    Returns
    Type Description
    Color

    The value of the Gradient, at the point in time specified.

    GetTexture()

    Gets the texture representation of this Gradient.

    Declaration
    public Texture2D GetTexture()
    Returns
    Type Description
    Texture2D

    A texture.

    Release()

    Releases the internal texture resource.

    Declaration
    public void Release()

    SetDirty()

    Marks the curve as dirty to trigger a redraw of the texture the next time GetTexture() is called.

    Declaration
    public void SetDirty()

    SetKeys(GradientColorKey[], GradientAlphaKey[], GradientMode, ColorSpace)

    Setup Gradient with an array of color keys and alpha keys.

    Declaration
    public void SetKeys(GradientColorKey[] colorKeys, GradientAlphaKey[] alphaKeys, GradientMode mode, ColorSpace colorSpace)
    Parameters
    Type Name Description
    GradientColorKey[] colorKeys

    Color keys of the gradient (maximum 8 color keys).

    GradientAlphaKey[] alphaKeys

    Alpha keys of the gradient (maximum 8 alpha keys).

    GradientMode mode

    Indicates the color space that the gradient color keys are using.

    ColorSpace colorSpace

    Controls how the gradient colors are interpolated.

    Implements

    IDisposable

    Extension Methods

    ReflectionUtils.GetField(object, string)
    ReflectionUtils.GetFields(object)
    ReflectionUtils.Invoke(object, string, params object[])
    ReflectionUtils.SetField(object, string, object)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, T)
    In This Article
    Back to top
    Copyright © 2024 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)