Bounding box detection platform support
The AR Foundation XRBoundingBoxSubsystem is supported on the following platforms:
Provider plug-in | Bounding box detection supported | Provider documentation |
---|---|---|
Google ARCore XR Plug-in | ||
Apple ARKit XR Plug-in | Yes | Bounding box detection (ARKit) |
Apple visionOS XR Plug-in | ||
Microsoft HoloLens | ||
Unity OpenXR: Meta | Yes | Bounding boxes (OpenXR Meta) |
Unity OpenXR: Android XR | ||
XR Simulation | Yes | N/A |
Check for bounding box detection support
Your app can check at runtime whether a provider plug-in supports bounding box detection on the user's device. This allows you to implement branching logic such as displaying information to the user if bounding boxes are not supported.
Use the example code below to check whether the device supports bounding box detection:
void Start()
{
if (LoaderUtility
.GetActiveLoader()?
.GetLoadedSubsystem<XRBoundingBoxSubsystem>() != null)
{
// XRBoundingBoxSubsystem was loaded. The platform supports bounding box detection.
}
}
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 bounding box subsystem. Each optional feature is defined by a Descriptor Property of the XRBoundingBoxSubsystemDescriptor, 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.
Feature | Descriptor Property | Description |
---|---|---|
Classification | supportsClassifications | Indicates whether the provider implementation can provide a value for ARBoundingBox.classifications. |
Optional feature platform support
The following table lists whether certain XR plug-in providers support each optional feature:
Feature | ARKit | OpenXR Meta | XR Simulation |
---|---|---|---|
Classification | Yes | Yes | Yes |
Check for optional feature support
Your app can check at runtime whether a bounding box detection provider supports any optional features on the user's device. The XRBoundingBoxSubsystemDescriptor contains boolean properties for each optional feature that tell you whether they are supported.
Refer to example code below 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<ARBoundingBoxManager>();
// Use manager.descriptor to determine which optional features
// are supported on the device. For example:
if (manager.descriptor.supportsClassifications)
{
// Classification is supported.
}
}
Apple and ARKit are trademarks of Apple Inc., registered in the U.S. and other countries and regions.