Class ARReferencePointManager | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class ARReferencePointManager

    Manages reference points (aka anchors).

    Inheritance
    System.Object
    ARReferencePointManager
    Namespace: UnityEngine.XR.ARFoundation
    Syntax
    public sealed class ARReferencePointManager : MonoBehaviour
    Remarks

    Use this component to programmatically add, remove, or query for reference points. Reference points are Poses in the world which will be periodically updated by an AR devices as its understanding of the world changes.

    Properties

    referencePointPrefab

    Getter/setter for the Reference Point Prefab.

    Declaration
    public GameObject referencePointPrefab { get; set; }
    Property Value
    Type Description
    GameObject

    Methods

    GetAllReferencePoints(List<ARReferencePoint>)

    Get all currently tracked ARReferencePoints.

    Declaration
    public void GetAllReferencePoints(List<ARReferencePoint> referencePointsOut)
    Parameters
    Type Name Description
    List<ARReferencePoint> referencePointsOut

    Replaces the contents with the current list of reference points.

    TryAddReferencePoint(Pose)

    Attempts to add an ARReferencePoint with the given Pose.

    Declaration
    public ARReferencePoint TryAddReferencePoint(Pose pose)
    Parameters
    Type Name Description
    Pose pose

    The pose, in Unity world space, of the ARReferencePoint.

    Returns
    Type Description
    ARReferencePoint

    If successful, a new ARReferencePoint. Otherwise, null.

    Remarks

    If referencePointPrefab is not null, a new instance will be created. Otherwise, a new GameObject will be created. In either case, this method ensures that the resulting GameObject has a ARReferencePoint component on it.

    TryAddReferencePoint(Vector3, Quaternion)

    Attempts to add an ARReferencePoint with the given position and rotation.

    Declaration
    public ARReferencePoint TryAddReferencePoint(Vector3 position, Quaternion rotation)
    Parameters
    Type Name Description
    Vector3 position

    The position, in Unity world space, of the ARReferencePoint.

    Quaternion rotation

    The rotation, in Unity world space, of the ARReferencePoint.

    Returns
    Type Description
    ARReferencePoint

    If successful, a new ARReferencePoint. Otherwise, null.

    Remarks

    If referencePointPrefab is not null, a new instance will be created. Otherwise, a new GameObject will be created. In either case, this method ensures that the resulting GameObject has a ARReferencePoint component on it.

    TryGetReferencePoint(TrackableId)

    Attempts to retrieve an existing ARReferencePoint previously added with TryAddReferencePoint(Pose).

    Declaration
    public ARReferencePoint TryGetReferencePoint(TrackableId referencePointId)
    Parameters
    Type Name Description
    TrackableId referencePointId

    The TrackableId associated with the reference point.

    Returns
    Type Description
    ARReferencePoint

    The ARReferencePoint with TrackableId referencePointId. Otherwise, null.

    TryRemoveReferencePoint(TrackableId)

    Attempts to remove an ARReferencePoint by TrackableId

    Declaration
    public bool TryRemoveReferencePoint(TrackableId referencePointId)
    Parameters
    Type Name Description
    TrackableId referencePointId

    The TrackableId associated with the ARReferencePoint you wish to remove.

    Returns
    Type Description
    System.Boolean

    True if the reference point was successfully removed. False usually means the reference point doesn't exist or isn't tracked by this manager.

    TryRemoveReferencePoint(ARReferencePoint)

    Attempts to remove an ARReferencePoint.

    Declaration
    public bool TryRemoveReferencePoint(ARReferencePoint referencePoint)
    Parameters
    Type Name Description
    ARReferencePoint referencePoint

    The reference point you wish to remove.

    Returns
    Type Description
    System.Boolean

    True if the reference point was successfully removed. False usually means the reference point doesn't exist or isn't tracked by this manager.

    Events

    referencePointUpdated

    Raised each time an ARReferencePoint is updated.

    Declaration
    public event Action<ARReferencePointUpdatedEventArgs> referencePointUpdated
    Event Type
    Type Description
    Action<ARReferencePointUpdatedEventArgs>
    Remarks

    This can happen when the ARReferencePoint's Pose changes, or when its TrackingState changes.

    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