docs.unity3d.com
    Show / Hide Table of Contents

    Class XRPlaneSubsystem

    This subsystem provides information regarding the detection of planes (that is, flat surfaces) in the real-world environment.

    Inheritance
    Object
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<XRPlaneSubsystem, XRPlaneSubsystemDescriptor, XRPlaneSubsystem.Provider>
    TrackingSubsystem<BoundedPlane, XRPlaneSubsystem, XRPlaneSubsystemDescriptor, XRPlaneSubsystem.Provider>
    XRPlaneSubsystem
    SimulationPlaneSubsystem
    Inherited Members
    TrackingSubsystem<BoundedPlane, XRPlaneSubsystem, XRPlaneSubsystemDescriptor, XRPlaneSubsystem.Provider>.GetChanges(Allocator)
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRPlaneSubsystem, UnityEngine.XR.ARSubsystems.XRPlaneSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRPlaneSubsystem.Provider>.OnCreate()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRPlaneSubsystem, UnityEngine.XR.ARSubsystems.XRPlaneSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRPlaneSubsystem.Provider>.OnStart()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRPlaneSubsystem, UnityEngine.XR.ARSubsystems.XRPlaneSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRPlaneSubsystem.Provider>.OnStop()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRPlaneSubsystem, UnityEngine.XR.ARSubsystems.XRPlaneSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRPlaneSubsystem.Provider>.OnDestroy()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRPlaneSubsystem, UnityEngine.XR.ARSubsystems.XRPlaneSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRPlaneSubsystem.Provider>.subsystemDescriptor
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider<UnityEngine.XR.ARSubsystems.XRPlaneSubsystem, UnityEngine.XR.ARSubsystems.XRPlaneSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRPlaneSubsystem.Provider>.provider
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider.Start()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider.OnStart()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider.Stop()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider.OnStop()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider.Destroy()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider.OnDestroy()
    UnityEngine.SubsystemsImplementation.SubsystemWithProvider.running
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    public class XRPlaneSubsystem : TrackingSubsystem<BoundedPlane, XRPlaneSubsystem, XRPlaneSubsystemDescriptor, XRPlaneSubsystem.Provider>, ISubsystem
    Remarks

    This is a base class with an abstract provider type to be implemented by provider plug-in packages. This class itself does not implement plane detection.

    Constructors

    XRPlaneSubsystem()

    Constructs a plane subsystem. Do not invoke directly. Instead, call Create(XRPlaneSubsystemDescriptor.Cinfo).

    Declaration
    public XRPlaneSubsystem()

    Properties

    currentPlaneDetectionMode

    Get the current PlaneDetectionMode in use by the provider.

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

    requestedPlaneDetectionMode

    Get or set the requested PlaneDetectionMode 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.

    Unity.Collections.Allocator allocator

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

    Unity.Collections.NativeArray<T> array

    The array to create or resize.

    Type Parameters
    Name Description
    T

    The type of elements held by the array.

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

    Gets the boundary vertices of a given BoundedPlane based on its trackableId.

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

    The TrackableId of a BoundedPlane.

    Unity.Collections.Allocator allocator

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

    Unity.Collections.NativeArray<UnityEngine.Vector2> boundary

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

    GetChanges(Allocator)

    Gets a TrackableChanges<T> struct containing any changes to detected planes since the last time you called this method. You are responsible to Dispose() the returned TrackableChanges instance.

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

    An Allocator to use for the returned NativeArrays.

    Returns
    Type Description
    TrackableChanges<BoundedPlane>

    The TrackableChanges<T>.

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

    The TrackableChanges<T> struct returned by this method contains separate Unity.Collections.NativeArray<T> objects for the added, updated, and removed planes. These arrays are created using the Unity.Collections.Allocator type specified by allocator.

    Back to top
    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