Class ARReferencePointManager
Manages reference points.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Syntax
[DisallowMultipleComponent]
[RequireComponent(typeof(ARSessionOrigin))]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.0/api/UnityEngine.XR.ARFoundation.ARReferencePointManager.html")]
[Obsolete("ARReferencePointManager has been deprecated. Use ARAnchorManager instead (UnityUpgradable) -> UnityEngine.XR.ARFoundation.ARAnchorManager", true)]
public sealed class ARReferencePointManager : ARTrackableManager<XRReferencePointSubsystem, XRReferencePointSubsystemDescriptor, XRReferencePoint, ARReferencePoint>
Remarks
Use this component to programmatically add, remove, or query for
reference points. Reference points are Pose
s in the world
which will be periodically updated by an AR device as its understanding
of the world changes.
Subscribe to changes (added, updated, and removed) via the referencePointsChanged event.
Properties
gameObjectName
The name given to each GameObject
associated with each ARReferencePoint.
Declaration
protected override string gameObjectName { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
referencePointPrefab
This prefab will be instantiated for each ARReferencePoint. May be null
.
Declaration
[Obsolete("ARReferencePointManger.referencePointPrefab has been renamed. Use ARAnchorManager.anchorPrefab instead (UnityUpgradable) -> UnityEngine.XR.ARFoundation.ARAnchorManager.anchorPrefab", true)]
public GameObject referencePointPrefab { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
Methods
AddReferencePoint(Pose)
Attempts to add an ARReferencePoint with the given Pose
.
Declaration
[Obsolete("ARReferencePointManger.AddReferencePoint() has been deprecated. Use ARAnchorManager.AddAnchor() instead (UnityUpgradable) -> UnityEngine.XR.ARFoundation.ARAnchorManager.AddAnchor(*)", true)]
public ARReferencePoint AddReferencePoint(Pose pose)
Parameters
Type | Name | Description |
---|---|---|
Pose | pose | The pose, in Unity world space, of the ARReferencePoint. |
Returns
Type | Description |
---|---|
ARReferencePoint | A new ARReferencePoint if successful, otherwise |
Remarks
If GetPrefab()
is not null, a new instance of that prefab will be instantiated. Otherwise, a
new GameObject
will be created. In either case, the resulting
GameObject
will have an ARReferencePoint component on it.
AttachReferencePoint(ARPlane, Pose)
Attempts to create a new reference point that is attached to an existing ARPlane.
Declaration
[Obsolete("ARReferencePointManger.AttachReferencePoint() has been deprecated. Use ARAnchorManager.AttachAnchor() instead (UnityUpgradable) -> UnityEngine.XR.ARFoundation.ARAnchorManager.AttachAnchor(*)", true)]
public ARReferencePoint AttachReferencePoint(ARPlane plane, Pose pose)
Parameters
Type | Name | Description |
---|---|---|
ARPlane | plane | The ARPlane to which to attach. |
Pose | pose | The initial |
Returns
Type | Description |
---|---|
ARReferencePoint | A new ARReferencePoint if successful, otherwise |
GetPrefab()
Gets the prefab that will be instantiated for each ARReferencePoint.
Declaration
protected override GameObject GetPrefab()
Returns
Type | Description |
---|---|
GameObject | The prefab that will be instantiated for each ARReferencePoint. |
Overrides
GetReferencePoint(TrackableId)
Gets the ARReferencePoint with given trackableId
,
or null
if it does not exist.
Declaration
[Obsolete("ARReferencePointManger.GetReferencePoint() has been deprecated. Use ARAnchorManager.GetAnchor() instead (UnityUpgradable) -> UnityEngine.XR.ARFoundation.ARAnchorManager.GetAnchor(*)", true)]
public ARReferencePoint GetReferencePoint(TrackableId trackableId)
Parameters
Type | Name | Description |
---|---|---|
TrackableId | trackableId | The TrackableId of the ARReferencePoint to retrieve. |
Returns
Type | Description |
---|---|
ARReferencePoint | The ARReferencePoint with |
OnTrackablesChanged(List<ARReferencePoint>, List<ARReferencePoint>, List<ARReferencePoint>)
Invoked when the base class detects trackable changes.
Declaration
protected override void OnTrackablesChanged(List<ARReferencePoint> added, List<ARReferencePoint> updated, List<ARReferencePoint> removed)
Parameters
Type | Name | Description |
---|---|---|
List<ARReferencePoint> | added | The list of added ARReferencePoints. |
List<ARReferencePoint> | updated | The list of updated ARReferencePoints. |
List<ARReferencePoint> | removed | The list of removed ARReferencePoints. |
Overrides
RemoveReferencePoint(ARReferencePoint)
Attempts to remove an ARReferencePoint.
Declaration
[Obsolete("ARReferencePointManger.RemoveReferencePoint() has been deprecated. Use ARAnchorManager.RemoveAnchor() instead (UnityUpgradable) -> UnityEngine.XR.ARFoundation.ARAnchorManager.RemoveAnchor(*)", true)]
public bool RemoveReferencePoint(ARReferencePoint referencePoint)
Parameters
Type | Name | Description |
---|---|---|
ARReferencePoint | referencePoint | The reference point you wish to remove. |
Returns
Type | Description |
---|---|
Boolean |
|
Events
referencePointsChanged
Invoked once per frame to communicate changes to reference points, including new reference points, the update of existing reference points, and the removal of previously existing reference points.
Declaration
[Obsolete("ARReferencePointManger.referencePointsChanged has been renamed. Use ARAnchorManager.anchorsChanged instead (UnityUpgradable) -> UnityEngine.XR.ARFoundation.ARAnchorManager.anchorsChanged", true)]
public event Action<ARReferencePointsChangedEventArgs> referencePointsChanged
Event Type
Type | Description |
---|---|
Action<ARReferencePointsChangedEventArgs> |