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
This component only responds to changes in detected planes while it is enabled. For example, if it is not enabled, planes may be generated by the device without this component knowing about them. When it is later enabled, it will not create ARPlanes for those unless it later receives an event for it, such as updated.
Properties
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> |