Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

GraphicsApiValidation.IsValidationRequested

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static bool IsValidationRequested();

Returns

bool true if validation was requested; otherwise false.

Description

Returns whether graphics API validation was requested via a backend-specific command line argument (for example, -force-d3d12-debug-as-errors on Direct3D 12).

A return value of true doesn't guarantee that validation is actually running. Use GraphicsApiValidation.IsValidationActive to confirm the debug layer initialized successfully.

using UnityEngine;
using UnityEngine.Rendering;

public class Example : MonoBehaviour { void WarnIfRequestedButInactive() { if (GraphicsApiValidation.IsValidationRequested() && !GraphicsApiValidation.IsValidationActive()) Debug.LogWarning("Graphics API validation was requested but the debug layer failed to initialize."); } }