Class ARPlaneManager
A manager for ARPlanes. Creates, updates, and removes
GameObject
s in response to detected surfaces in the physical
environment.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Syntax
[DefaultExecutionOrder(-2147483647)]
[DisallowMultipleComponent]
[RequireComponent(typeof(ARSessionOrigin))]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.1/api/UnityEngine.XR.ARFoundation.ARPlaneManager.html")]
public sealed class ARPlaneManager : ARTrackableManager<XRPlaneSubsystem, XRPlaneSubsystemDescriptor, BoundedPlane, ARPlane>, IRaycaster
Properties
currentDetectionMode
Get the current plane detection mode in use by the subsystem.
Declaration
public PlaneDetectionMode currentDetectionMode { get; }
Property Value
Type | Description |
---|---|
PlaneDetectionMode |
detectionMode
Get or set the PlaneDetectionMode
to use for plane detection.
This property is obsolete.
Use requestedDetectionMode or currentDetectionMode instead.
Declaration
[Obsolete("Use requestedDetectionMode or currentDetectionMode instead")]
public PlaneDetectionMode detectionMode { get; set; }
Property Value
Type | Description |
---|---|
PlaneDetectionMode |
gameObjectName
The name to be used for the GameObject
whenever a new plane is detected.
Declaration
protected override string gameObjectName { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
planePrefab
Getter/setter for the Plane Prefab.
Declaration
public GameObject planePrefab { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
requestedDetectionMode
Get or set the requested plane detection mode.
Declaration
public PlaneDetectionMode requestedDetectionMode { get; set; }
Property Value
Type | Description |
---|---|
PlaneDetectionMode |
Methods
GetPlane(TrackableId)
Attempt to retrieve an existing ARPlane by trackableId
.
Declaration
public ARPlane GetPlane(TrackableId trackableId)
Parameters
Type | Name | Description |
---|---|---|
TrackableId | trackableId | The TrackableId of the plane to retrieve. |
Returns
Type | Description |
---|---|
ARPlane | The ARPlane with |
GetPrefab()
Get the prefab which will be instantiated for each ARPlane. May be null
.
Declaration
protected override GameObject GetPrefab()
Returns
Type | Description |
---|---|
GameObject | The prefab which will be instantiated for each ARPlane. |
Overrides
OnAfterSetSessionRelativeData(ARPlane, BoundedPlane)
Invoked just after each ARPlane is updated.
Declaration
protected override void OnAfterSetSessionRelativeData(ARPlane plane, BoundedPlane sessionRelativeData)
Parameters
Type | Name | Description |
---|---|---|
ARPlane | plane | The ARPlane being updated. |
BoundedPlane | sessionRelativeData | The new data associated with the plane. All spatial data is is session-relative space. |
Overrides
OnBeforeStart()
Invoked just before Start
ing the plane subsystem. Used to set the subsystem's
requestedPlaneDetectionMode
.
Declaration
protected override void OnBeforeStart()
Overrides
OnDisable()
Invoked when Unity disables this MonoBehaviour
. Used to unregister with the ARRaycastManager.
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Invoked when Unity enables this MonoBehaviour
. Used to register with the ARRaycastManager.
Declaration
protected override void OnEnable()
Overrides
OnTrackablesChanged(List<ARPlane>, List<ARPlane>, List<ARPlane>)
Invoked when the base class detects trackable changes.
Declaration
protected override void OnTrackablesChanged(List<ARPlane> added, List<ARPlane> updated, List<ARPlane> removed)
Parameters
Type | Name | Description |
---|---|---|
List<ARPlane> | added | The list of added ARPlanes. |
List<ARPlane> | updated | The list of updated ARPlanes. |
List<ARPlane> | removed | The list of removed ARPlanes. |
Overrides
Raycast(Ray, TrackableType, Allocator)
Performs a raycast against all currently tracked planes.
Declaration
public NativeArray<XRRaycastHit> Raycast(Ray ray, TrackableType trackableTypeMask, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The ray, in Unity world space, to cast. |
TrackableType | trackableTypeMask | A mask of raycast types to perform. |
Allocator | allocator | The |
Returns
Type | Description |
---|---|
NativeArray<XRRaycastHit> | A new |
See Also
Events
planesChanged
Invoked when planes have changed (been added, updated, or removed).
Declaration
public event Action<ARPlanesChangedEventArgs> planesChanged
Event Type
Type | Description |
---|---|
Action<ARPlanesChangedEventArgs> |