> For the complete documentation index, see [llms.txt](https://ashobot.gitbook.io/ultimate-attributes-pack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ashobot.gitbook.io/ultimate-attributes-pack/validators.md).

# Validators

<details>

<summary>Required</summary>

Displays an error helpbox above the variable if it's empty.

**Supported property types**

* String
* Object Reference
* Exposed Reference
* Managed Reference

**Parameters**

* LogError

<mark style="color:purple;">Code Example</mark>

<pre class="language-csharp"><code class="lang-csharp">using UltimateAttributesPack;
<strong>
</strong><strong>public class RequiredExample : MonoBehaviour
</strong>    {
        // Required attribute displays an helpbox in inspector if the variable is null
        [Required]
        public GameObject exampleObject;

        // You can also set the param to true to log an error in the console if the variable is null
        [Required(true)]
        public GameObject secondExampleObject;
    }
</code></pre>

<img src="https://3496865040-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJRT3Vo5QZSbuYGZVtRD%2Fuploads%2FlAKxYb4AKNyW04mGF7hx%2FRequired.PNG?alt=media&amp;token=18709cae-8d40-4923-8c29-e6644859b2e3" alt="" data-size="original">

</details>

<details>

<summary>MinValue</summary>

Clamps the variable to a minimum value.

**Supported property types**

* Float
* Int

**Parameters**

* MinValue

<mark style="color:purple;">Code Example</mark>

```csharp
using UltimateAttributesPack;

public class MinValueExample : MonoBehaviour
    {
        // MinValue attribute clamp the variable to a minimum
        [MinValue(0)]
        public int intValue;

        // It also works with floats
        [MinValue(2.5f)]
        public float floatValue = 2.5f;
    }
```

<img src="https://3496865040-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJRT3Vo5QZSbuYGZVtRD%2Fuploads%2F1Mbeg7hIn0yF2IyOSvHR%2FMinValue.gif?alt=media&amp;token=842b9cc4-173d-46d9-a14a-1b8df5f1acad" alt="" data-size="original">

</details>

<details>

<summary>MaxValue</summary>

Clamps the variable to a maximum value.

**Supported property types**

* Float
* Int

**Parameters**

* MaxValue

<mark style="color:purple;">Code Example</mark>

<pre class="language-csharp"><code class="lang-csharp">using UltimateAttributesPack;
<strong>
</strong><strong>public class MaxValueExample : MonoBehaviour
</strong>    {
        // MaxValue attribute clamp the variable to a maximum
        [MaxValue(5)]
        public int intValue;

        // It also works with floats
        [MaxValue(2.5f)]
        public float floatValue;
    }
</code></pre>

<img src="https://3496865040-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJRT3Vo5QZSbuYGZVtRD%2Fuploads%2FisRtIAEkDXuAvtGk9F8d%2FMaxValue.gif?alt=media&amp;token=32d8a52c-64c5-4e78-82cf-12b8b03e1b9d" alt="" data-size="original">

</details>

***
