Class ARPlaneManager
Creates, updates, and removes GameObject
s with ARPlane components under the ARSessionOrigin's trackablesParent.
Inheritance
Namespace: UnityEngine.XR.ARFoundation
Syntax
public sealed class ARPlaneManager : MonoBehaviour
Remarks
When enabled, this component subscribes to planeAdded, planeUpdated, and planeRemoved. If this component is disabled, and there are no other subscribers to those events, plane detection will be disabled on the device.
Properties
detectionFlags
Get or set the PlaneDetectionFlags
to use for plane detection.
Declaration
public PlaneDetectionFlags detectionFlags { get; set; }
Property Value
Type | Description |
---|---|
PlaneDetectionFlags |
planeCount
Get the number of planes managed by this manager.
Declaration
public int planeCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
planePrefab
Getter/setter for the Plane Prefab.
Declaration
public GameObject planePrefab { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
Methods
GetAllPlanes(List<ARPlane>)
Get all currently tracked ARPlanes.
Declaration
public void GetAllPlanes(List<ARPlane> planes)
Parameters
Type | Name | Description |
---|---|---|
List<ARPlane> | planes | Replaces the contents with the current list of planes. |
TryGetPlane(TrackableId)
Attempts to retrieve an ARPlane.
Declaration
public ARPlane TryGetPlane(TrackableId planeId)
Parameters
Type | Name | Description |
---|---|---|
TrackableId | planeId | The |
Returns
Type | Description |
---|---|
ARPlane | The ARPlaneif found. |
Events
planeAdded
Raised for each new ARPlane detected in the environment.
Declaration
public event Action<ARPlaneAddedEventArgs> planeAdded
Event Type
Type | Description |
---|---|
Action<ARPlaneAddedEventArgs> |
planeRemoved
Raised whenever an ARPlane is removed.
Declaration
public event Action<ARPlaneRemovedEventArgs> planeRemoved
Event Type
Type | Description |
---|---|
Action<ARPlaneRemovedEventArgs> |
planeUpdated
Raised for each ARPlane every time it updates.
Declaration
public event Action<ARPlaneUpdatedEventArgs> planeUpdated
Event Type
Type | Description |
---|---|
Action<ARPlaneUpdatedEventArgs> |