VR4Medical/ICI/Library/PackageCache/com.unity.xr.openxr@3903c1059bcf/Samples~/InterceptFeature/README.md
2025-07-29 13:45:50 +03:00

1.1 KiB

Intercept Feature Sample

Demonstrates intercepting an OpenXR method using an OpenXR Feature.

The OpenXR API allows any of its functions to be intercepted by providing a custom xrGetInstanceProcAddr method. Within Unity this can be done by implementing a custom OpenXRFeature and overriding the HookGetInstanceProcAddr to provide an alternative version of the xrGetInstanceProcAddr method. Once in place this method can return alternative versions of any of the OpenXR methods. In this sample this mechanism is used to hook the xrCreateSession method such that each time xrCreateSession is called it will invoke a C# callback with a message string, which is then displayed on screen.

See the Unity OpenXR Documentation for more information on developing a custom feature.

See the OpenXR API Specification for more information on OpenXR.