AR anchor manager | AR Foundation | 3.1.10
docs.unity3d.com
    Show / Hide Table of Contents

    AR anchor manager

    The anchor manager is a type of trackable manager.

    AR anchor manager

    The anchor manager creates GameObjects for each anchor. An anchor is a particular point in space that you want the device to track. The device typically performs additional work to update the position and orientation of the anchor throughout its lifetime. Because anchors are generally resource-intensive objects, you should use them sparingly.

    Adding and removing anchors

    To add or remove anchors, call AddAnchor or RemoveAnchor on the ARAnchorManager component in script. In some scenarios, you can create anchors in other ways, such as loading an AR World Map on ARKit which includes saved anchors.

    When you add an anchor, it might take a frame or two before the anchor manager's anchorsChanged event reports it as added. During the time between being added and being reported as added, the anchor will be in a "pending" state. You can query for this with the ARAnchor.pending property.

    Likewise, when you remove an anchor, it might take a frame before anchorsChanged reports it as removed. If you remove an anchor before it's reported as added, you won't receive any events for it.

    You should always remove anchors through the anchor manager. Don't Destroy an ARAnchor unless its manager has also been destroyed.

    Attaching anchors

    You can also create anchors that are attached to a plane. The following ARAnchorManager component does this:

    public ARAnchor AttachAnchor(ARPlane plane, Pose pose)
    

    Attaching an anchor to a plane affects the anchor update semantics. Anchors can only change their position along the normal of the plane they are attached to, which means they effectively maintain a constant distance from the plane.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023