bool true if validation is active; otherwise false.
Returns whether graphics API validation is active and the debug layer initialized successfully.
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.
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; } }