IsValidationActive()
Returns whether graphics API validation is active and the debug layer initialized successfully.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
public static bool IsValidationActive()
Returns
Type | Description |
|---|---|
| bool | true if validation is active; otherwise false. |
Remarks
This returns true only if you requested validation (see GraphicsApiValidation.IsValidationRequested) and the debug layer successfully attached during device creation. Use this as the canonical gate before calling other GraphicsApiValidation members, since on platforms or runs where validation isn't active the other members have no effect.
Examples
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; }}