# IsValidationActive()

> Returns whether graphics API validation is active and the debug layer initialized successfully.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Rendering](/engine/6000.6/script-reference/unityengine/rendering.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public static bool IsValidationActive()
```

### Returns

| Type                                                          | Description                                    |
| ------------------------------------------------------------- | ---------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | true if validation is active; otherwise false. |

### Remarks

This returns true only if you requested validation (see [GraphicsApiValidation.IsValidationRequested](/engine/6000.6/script-reference/unityengine/rendering/graphicsapivalidation/isvalidationrequested.md)) and the debug layer successfully attached during device creation. Use this as the canonical gate before calling other [GraphicsApiValidation](/engine/6000.6/script-reference/unityengine/rendering/graphicsapivalidation.md) members, since on platforms or runs where validation isn't active the other members have no effect.

### Examples

```csharp
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;

public class Example : MonoBehaviour
{
    // Returns null when validation isn't active so callers can skip
    // reporting on platforms or runs where errors can't be collected.
    IReadOnlyList<string> CollectValidationErrors()
    {
        if (!GraphicsApiValidation.IsValidationActive())
            return null;

        int count = GraphicsApiValidation.GetValidationErrorCount();
        var errors = new List<string>(count);
        for (int i = 0; i < count; i++)
        {
            errors.Add(GraphicsApiValidation.GetValidationError(i));
        }
        return errors;
    }
}
```
