Occlusion platform support
The AR Foundation XROcclusionSubsystem is supported on the following platforms:
Provider plug-in | Occlusion supported | Provider documentation |
---|---|---|
Google ARCore XR Plug-in | Yes | Occlusion (ARCore) |
Apple ARKit XR Plug-in | Yes | Occlusion (ARKit) |
Apple visionOS XR Plug-in | ||
Microsoft HoloLens | ||
Unity OpenXR: Meta | Yes | Occlusion (OpenXR Meta) |
Unity OpenXR: Android XR | Yes | Occlusion (Android XR) |
XR Simulation | Yes | Occlusion (XR Simulation) |
Check for occlusion support
Your app can check at runtime whether a provider plug-in supports occlusion on the user's device.
Use the example code below to check whether the device supports occlusion:
void Start()
{
if (LoaderUtility
.GetActiveLoader()?
.GetLoadedSubsystem<XROcclusionSubsystem>() != null)
{
// XROcclusionSubsystem was loaded. The platform supports occlusion.
}
}
Note
This example code assumes that your app has already initialized XR.
By default XR initializes automatically when your app starts, but this is configurable via Project Settings > XR Plug-in Management > Initialize XR on Startup. Refer to the XR Plug-in Management End-user documentation for more detailed information about managing the XR Plug-in lifecycle.
Optional features
The following table lists the optional features of the occlusion subsystem. Each optional feature is defined by a Descriptor Property of the XROcclusionSubsystemDescriptor, which you can check at runtime to determine whether a feature is supported. Refer to Check for optional feature support for a code example to check whether a feature is supported. Refer to AR Occlusion Manager component for more information about the types of depth image described.
Feature | Descriptor Property | Description |
---|---|---|
Environment Depth Confidence Image | environmentDepthConfidenceImageSupported | Whether the subsystem supports environment depth confidence image. |
Environment Depth Image | environmentDepthImageSupported | Whether the subsystem supports environment depth image. |
Environment Depth Temporal Smoothing | environmentDepthTemporalSmoothingSupported | Whether temporal smoothing of the environment image is supported. |
Human Segmentation Depth Image | humanSegmentationDepthImageSupported | Whether a subsystem supports human segmentation depth image. |
Human Segmentation Stencil Image | humanSegmentationStencilImageSupported | Whether a subsystem supports human segmentation stencil image. |
Optional feature platform support
The following table lists whether certain XR plug-in providers support each optional feature:
Feature | ARCore | ARKit | OpenXR Meta | Android XR | XR Simulation |
---|---|---|---|---|---|
Environment Depth Confidence Image | Yes | Yes | Yes | ||
Environment Depth Image | Yes | Yes | Yes | Yes | Yes |
Environment Depth Temporal Smoothing | Yes | Yes | Yes | ||
Human Segmentation Depth Image | Yes | ||||
Human Segmentation Stencil Image | Yes |
Check for optional feature support
Your app can check at runtime whether an occlusion provider supports any optional features on the user's device. The XROcclusionSubsystemDescriptor contains properties for each optional feature that tell you whether they are supported.
Refer to the following example code to learn how to check for optional feature support:
void CheckForOptionalFeatureSupport()
{
// This is inefficient. You should re-use a saved reference instead.
var manager = Object.FindAnyObjectByType<AROcclusionManager>();
// Use manager.descriptor to determine which optional features
// are supported on the device. For example:
if (manager.descriptor.environmentDepthImageSupported == Supported.Supported)
{
// Environment depth image is supported.
}
}
Apple and ARKit are trademarks of Apple Inc., registered in the U.S. and other countries and regions.