# GradientUsageAttribute

> Attribute for gradient fields. Used to configure the GUI for the Gradient Editor.

## Definition

* **Type:** Constructor
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## GradientUsageAttribute(bool)

Attribute for gradient fields. Used to configure the GUI for the Gradient Editor.

```csharp
public GradientUsageAttribute(bool hdr)
```

### Parameters

**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Set to true if the colors should be treated as HDR colors (default value: false).

### Examples

```csharp
using UnityEngine;

public class ExampleScript : MonoBehaviour
{
    // Inspector editor for this gradient
    // allows to setup regular low dynamic range
    // colors.
    public Gradient defaultGradient;

    // Inspector editor for this gradient allows
    // to setup HDR colors.
    [GradientUsage(true)]
    public Gradient hdrGradient;
}
```

## GradientUsageAttribute(bool, ColorSpace)

Attribute for gradient fields. Used to configure the GUI for the Gradient Editor.

```csharp
public GradientUsageAttribute(bool hdr, ColorSpace colorSpace)
```

### Parameters

**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Set to true if the colors should be treated as HDR colors (default value: false).**** (\[ColorSpace]\(/engine/6000.0/script-reference/unityengine/colorspace)): The colors should be treated as from this color space (default value: ColorSpace.Gamma).

### Examples

```csharp
using UnityEngine;

public class ExampleScript : MonoBehaviour
{
    // Inspector editor for this gradient
    // allows to setup regular low dynamic range
    // colors.
    public Gradient defaultGradient;

    // Inspector editor for this gradient allows
    // to setup HDR colors.
    [GradientUsage(true)]
    public Gradient hdrGradient;
}
```
