docs.unity3d.com
    Show / Hide Table of Contents

    Class XRPlaneSubsystem

    Base class for plane subsystems.

    Inheritance
    Object
    Subsystem
    Subsystem<XRPlaneSubsystemDescriptor>
    XRSubsystem<XRPlaneSubsystemDescriptor>
    TrackingSubsystem<BoundedPlane, XRPlaneSubsystemDescriptor>
    XRPlaneSubsystem
    XRPlaneSubsystemImpl
    Inherited Members
    TrackingSubsystem<BoundedPlane, XRPlaneSubsystemDescriptor>.GetChanges(Allocator)
    XRSubsystem<XRPlaneSubsystemDescriptor>.running
    XRSubsystem<XRPlaneSubsystemDescriptor>.OnDestroy()
    XRSubsystem<XRPlaneSubsystemDescriptor>.Start()
    XRSubsystem<XRPlaneSubsystemDescriptor>.Stop()
    Subsystem<XRPlaneSubsystemDescriptor>.SubsystemDescriptor
    Subsystem.Destroy()
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    public abstract class XRPlaneSubsystem : TrackingSubsystem<BoundedPlane, XRPlaneSubsystemDescriptor>, ISubsystem
    Remarks

    This subsystem surfaces information regarding plane (i.e., flat surface) detection in the physical environment. Implementations are typically found in other provider or platform-specific packages.

    Constructors

    XRPlaneSubsystem()

    Constructs a plane subsystem. Do not invoked directly; call Create on the XRPlaneSubsystemDescriptor instead.

    Declaration
    public XRPlaneSubsystem()

    Properties

    currentPlaneDetectionMode

    Get the current PlaneDetectionMode in use by the provider.

    Declaration
    public PlaneDetectionMode currentPlaneDetectionMode { get; }
    Property Value
    Type Description
    PlaneDetectionMode

    provider

    The provider created by the implementation that contains the required plane tracking functionality.

    Declaration
    protected XRPlaneSubsystem.Provider provider { get; }
    Property Value
    Type Description
    XRPlaneSubsystem.Provider

    requestedPlaneDetectionMode

    Get or set the requested PlaneDetectionMode, e.g., to enable different modes of detection.

    Declaration
    public PlaneDetectionMode requestedPlaneDetectionMode { get; set; }
    Property Value
    Type Description
    PlaneDetectionMode
    Exceptions
    Type Condition
    NotSupportedException

    Thrown if requestedPlaneDetectionMode is set to something other than None when plane detection is not supported.

    Methods

    CreateOrResizeNativeArrayIfNecessary<T>(Int32, Allocator, ref NativeArray<T>)

    Creates or resizes the array if necessary. If array has been allocated and its length is equal to length, then this method does nothing. If its length is different, then it is first disposed before being assigned to a new NativeArray.

    Declaration
    protected static void CreateOrResizeNativeArrayIfNecessary<T>(int length, Allocator allocator, ref NativeArray<T> array)
        where T : struct
    Parameters
    Type Name Description
    Int32 length

    The length that array will have after this method returns.

    Allocator allocator

    If allocation is necessary, this allocator will be used to create the new NativeArray.

    NativeArray<T> array

    The array to create or resize.

    Type Parameters
    Name Description
    T

    The type of elements held by the array.

    CreateProvider()

    Concrete classes must implement this to provide the provider-specific implementation.

    Declaration
    protected abstract XRPlaneSubsystem.Provider CreateProvider()
    Returns
    Type Description
    XRPlaneSubsystem.Provider

    GetBoundary(TrackableId, Allocator, ref NativeArray<Vector2>)

    Gets the boundary polygon describing the plane.

    Declaration
    public void GetBoundary(TrackableId trackableId, Allocator allocator, ref NativeArray<Vector2> boundary)
    Parameters
    Type Name Description
    TrackableId trackableId

    The TrackableId associated with the plane of which to retrieve the boundary.

    Allocator allocator

    An Allocator to use if boundary needs to be created. Allocator.Temp is not supported; use Allocator.TempJob if you need temporary memory.

    NativeArray<Vector2> boundary

    The boundary will be stored here. If boundary is the same length as the new boundary, it is simply overwritten with the new data. Otherwise, it is disposed and recreated with the correct length.

    GetChanges(Allocator)

    Get the changes (added, updated, and removed) planes since the last call to GetChanges(Allocator).

    Declaration
    public override TrackableChanges<BoundedPlane> GetChanges(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    An Allocator to use when allocating the returned NativeArrays.

    Returns
    Type Description
    TrackableChanges<BoundedPlane>

    TrackableChanges<T> describing the planes that have been added, updated, and removed since the last call to GetChanges(Allocator). The caller owns the memory allocated with Allocator.

    Overrides
    UnityEngine.XR.ARSubsystems.TrackingSubsystem<UnityEngine.XR.ARSubsystems.BoundedPlane, UnityEngine.XR.ARSubsystems.XRPlaneSubsystemDescriptor>.GetChanges(Unity.Collections.Allocator)

    OnDestroyed()

    Destroy the plane subsystem.

    Declaration
    protected sealed override void OnDestroyed()
    Overrides
    UnityEngine.XR.ARSubsystems.XRSubsystem<UnityEngine.XR.ARSubsystems.XRPlaneSubsystemDescriptor>.OnDestroyed()

    OnStart()

    Start the plane subsystem, i.e., start tracking planes.

    Declaration
    protected sealed override void OnStart()
    Overrides
    UnityEngine.XR.ARSubsystems.XRSubsystem<UnityEngine.XR.ARSubsystems.XRPlaneSubsystemDescriptor>.OnStart()

    OnStop()

    Stop the subsystem, i.e., stop tracking planes.

    Declaration
    protected sealed override void OnStop()
    Overrides
    UnityEngine.XR.ARSubsystems.XRSubsystem<UnityEngine.XR.ARSubsystems.XRPlaneSubsystemDescriptor>.OnStop()
    Back to top
    Terms of use
    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