Bounding box detection platform support
Bounding box detection is only supported on the Meta OpenXR platform, as shown in the table below:
Provider plug-in | Bounding box detection supported | Provider documentation |
---|---|---|
Google ARCore XR Plug-in | ||
Apple ARKit XR Plug-in | ||
Apple visionOS XR Plug-in | ||
Microsoft HoloLens | ||
Unity OpenXR: Meta | Yes | N/A |
XR Simulation |
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
Bounding box detection providers may choose whether to implement the optional features of AR Foundation's XRBoundingBoxSubsystem, as indicated in the table below:
Feature | Description | ARCore | ARKit | Meta OpenXR | XR Simulation |
---|---|---|---|---|---|
Classification | Indicates whether the provider implementation can provide a value for ARBoundingBox.classifications. |
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.