docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Plane detection platform support

    Plane detection is supported on the ARCore, ARKit, Meta OpenXR and XR Simulation platforms, as shown in the table below:

    Provider plug-in Plane detection supported Provider documentation
    Google ARCore XR Plug-in Yes Plane detection (ARCore)
    Apple ARKit XR Plug-in Yes Plane detection (ARKit)
    Apple visionOS XR Plug-in
    HoloLens
    Unity OpenXR: Meta Yes Plane detection (Meta OpenXR)
    XR Simulation Yes N/A

    Check for plane detection support

    Your app can check at runtime whether a provider plug-in supports plane detection on the user's device. This is primarily useful in situations where you are unsure if the device supports plane detection, which may be the case if you are using AR Foundation with a third-party provider plug-in.

    Use the example code below to check whether the device supports plane detection:

    void Start()
    {
        if (LoaderUtility
                .GetActiveLoader()?
                .GetLoadedSubsystem<XRPlaneSubsystem>() != null)
        {
            // XRPlaneSubsystem was loaded. The platform supports plane 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

    Plane detection providers may choose whether to implement any of the optional features of AR Foundation's XRPlaneSubsystem, as indicated in the table below:

    Feature Description ARCore ARKit Meta OpenXR XR Simulation
    Horizontal plane detection Indicates whether the provider implementation supports the detection of horizontal planes, such as the floor. Yes Yes Yes Yes
    Vertical plane detection Indicates whether the provider implementation supports the detection of vertical planes, such as walls. Yes iOS 11.3+ Yes Yes
    Arbitrary plane detection Indicates whether the provider implementation supports the detection of planes that are aligned with neither the horizontal nor vertical axes. Yes
    Boundary vertices Indicates whether the provider implementation supports boundary vertices for its planes. Yes Yes Yes Yes
    Classification Indicates whether the provider implementation can provide a value for ARPlane.classifications. iOS 12+ Yes

    Check for optional feature support

    Your app can check at runtime whether a plane detection provider supports any optional features on the user's device. The XRPlaneSubsystemDescriptor 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<ARPlaneManager>();
    
        // Use manager.descriptor to determine which optional features
        // are supported on the device. For example:
    
        if (manager.descriptor.supportsClassification)
        {
            // Classification is supported.
        }
    }
    

    Apple and ARKit are trademarks of Apple Inc., registered in the U.S. and other countries and regions.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)