Class DebugUtilsFeature
Provides support for the XR_EXT_debug_utils OpenXR extension for debugging and development. This feature enables debug message callbacks from the OpenXR runtime with configurable severity and type filtering.
Inherited Members
Namespace: UnityEngine.XR.OpenXR.Features
Assembly: Unity.XR.OpenXR.dll
Syntax
public class DebugUtilsFeature : OpenXRFeature
Remarks
Enable this feature to receive debug messages from the OpenXR runtime. Use the messageSeverity and messageType
properties to filter which messages you want to receive. Messages are logged to the Unity console with the
[Debug Utils] prefix. This feature is particularly useful during development to identify validation errors,
performance warnings, and conformance issues in your OpenXR application.
Examples
This example shows how to configure the Debug Utils feature to receive only error and warning messages:
OpenXRSettings settings = OpenXRSettings.GetSettingsForBuildTargetGroup(BuildTargetGroup.Standalone);
DebugUtilsFeature debugUtilsFeature = settings.GetFeature<DebugUtilsFeature>();
if (debugUtilsFeature != null)
{
debugUtilsFeature.messageSeverity = DebugUtilsFeature.MessageSeverity.Error | DebugUtilsFeature.MessageSeverity.Warning;
debugUtilsFeature.messageType = DebugUtilsFeature.MessageType.Validation | DebugUtilsFeature.MessageType.Performance;
}
Fields
featureId
A unique identifier for this feature.
Declaration
public const string featureId = "com.unity.openxr.feature.debugutils"
Field Value
| Type | Description |
|---|---|
| string |
See Also
Properties
messageSeverity
The severity level the debug utils extension should use to filter messages.
Declaration
public DebugUtilsFeature.MessageSeverity messageSeverity { get; set; }
Property Value
| Type | Description |
|---|---|
| DebugUtilsFeature.MessageSeverity |
See Also
messageType
The message type that the debug utils extension should use to filter messages.
Declaration
public DebugUtilsFeature.MessageType messageType { get; set; }
Property Value
| Type | Description |
|---|---|
| DebugUtilsFeature.MessageType |
See Also
Methods
HookGetInstanceProcAddr(IntPtr)
Hooks into the OpenXR instance creation process to configure the XR Debug Utils extension. This override initializes the native debug callback with the configured message filters.
Declaration
protected override IntPtr HookGetInstanceProcAddr(IntPtr hookGetInstanceProcAddr)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | hookGetInstanceProcAddr | The original GetInstanceProcAddr function pointer. |
Returns
| Type | Description |
|---|---|
| IntPtr | The original GetInstanceProcAddr function pointer passed to the method. |
Overrides
Remarks
This method is called before the OpenXR instance is created. It registers a managed callback that will receive debug messages from the OpenXR runtime based on the configured messageSeverity and messageType filters. The callback remains active until the OpenXR instance is destroyed.
Examples
This method is called automatically by the OpenXR loader. You typically don't need to call it directly.
However, you can override it in a derived class to add custom initialization:
public class CustomDebugUtils : DebugUtilsFeature
{
protected internal override IntPtr HookGetInstanceProcAddr(IntPtr hookGetInstanceProcAddr)
{
Debug.Log("Initializing custom debug utilities");
return base.HookGetInstanceProcAddr(hookGetInstanceProcAddr);
}
}
See Also
OnInstanceCreate(ulong)
This method triggers when the OpenXR instance is successfully created.
Declaration
protected override bool OnInstanceCreate(ulong xrInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrInstance | The handle to the created OpenXR instance. |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
See Also
OnInstanceDestroy(ulong)
This method triggers the teardown process for all support classes.
Declaration
protected override void OnInstanceDestroy(ulong xrInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrInstance | The handle of the OpenXR instance being destroyed. |