Skip to content

Game.Prefabs.GradientLegendType

Assembly:
Assembly-CSharp.dll

Namespace:
Game.Prefabs

Type:
public enum

Base:
System.Enum

Summary:
Defines the display style for a legend used by prefabs that render gradients or discrete fields in the UI (for example map legends or tooltip legends). Use this enum to choose between a continuous gradient representation or a discrete/field-based representation.


Fields

  • Gradient
    Represents a continuous gradient legend. Use when the legend should show a smooth color ramp (e.g., elevation, temperature, pollution intensity).

  • Fields
    Represents a discrete/field legend. Use when the legend should show distinct segments or categories (e.g., named ranges, discrete levels, or labeled buckets).

Properties

  • This enum has no properties.

Constructors

  • Enums do not declare custom constructors in C#. The underlying type is int by default; members are assigned sequential integer values (Gradient = 0, Fields = 1) unless explicitly specified.

Methods

  • This enum does not declare custom methods. Standard System.Enum methods are available (e.g., ToString(), Parse(), GetValues()).

Usage Example

using Game.Prefabs;

public class LegendRenderer
{
    private GradientLegendType legendType;

    public LegendRenderer(GradientLegendType type)
    {
        legendType = type;
    }

    public void Render()
    {
        switch (legendType)
        {
            case GradientLegendType.Gradient:
                // Render a smooth color ramp
                RenderGradient();
                break;
            case GradientLegendType.Fields:
                // Render discrete color blocks with labels
                RenderFields();
                break;
        }
    }

    private void RenderGradient() { /* implementation */ }
    private void RenderFields() { /* implementation */ }
}

Additional notes: - Enums are serialized as integers in Unity; changing the order or removing members can break saved data. If you need to change values later, explicitly set the integer values for each member to preserve compatibility. - Use descriptive names when selecting the type so code reading remains clear (Gradient vs Fields).