docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Anchors

    This page is a supplement to the AR Foundation Anchors manual. The following sections only contain information about APIs where Meta Quest exhibits unique platform-specific behavior.

    Tip

    When developing an AR app, refer to both the AR Foundation documentation as well as the required packages for each platform you support.

    Trackable ID

    Unlike some other AR platforms, Meta's OpenXR runtime only supports creating anchors asynchronously. To fulfill AR Foundation's synchronous API design for TryAddAnchor, this package generates monotonically increasing TrackableIds for anchors.

    Native pointer

    XRAnchor.nativePtr values returned by this package contain a pointer to the following struct:

    typedef struct UnityXRNativeAnchor
    {
        int version;
        void* referencePointPtr;
    } UnityXRNativeAnchor;
    

    Cast the void* referencePointPtr to an XrSpace handle in C++ using the following example code:

    // Marhshal the native anchor data from the XRAnchor.nativePtr in C#
    UnityXRNativeAnchor nativeAnchor;
    XrSpace* anchorXrSpaceHandle = static_cast<XrSpace*>(nativeAnchor.referencePointPtr);
    

    To learn more about native pointers and their usage, refer to Extending AR Foundation.

    In This Article
    Back to top
    Copyright © 2025 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)